php - MySQL: Android real device not able to connect mysly in PC. Emmulator is able to connect -
i trying write data on mysql on laplop. below code works on emulator code not work on real device. have wifi , have connected android device through usp testing purpose. please help.
@override protected string doinbackground(string... params) { string reg_url = "http://192.168.0.101/kiranapp/register.php"; string method = params[0]; if(method.equals("register")) { string name = params[1]; string username = params[2]; string userpass = params[3]; try { url url = new url(reg_url); httpurlconnection httpurlconnection = (httpurlconnection) url.openconnection(); httpurlconnection.setrequestmethod("post"); httpurlconnection.setdooutput(true); outputstream os = httpurlconnection.getoutputstream(); bufferedwriter bufferedwriter = new bufferedwriter(new outputstreamwriter(os,"utf-8")); string data = urlencoder.encode("user","utf-8") +"="+urlencoder.encode(name,"utf-8")+"&"+ urlencoder.encode("user_name","utf-8") +"="+urlencoder.encode(username,"utf-8")+"&"+ urlencoder.encode("user_pass","utf-8") +"="+urlencoder.encode(userpass,"utf-8"); bufferedwriter.write(data); bufferedwriter.flush(); bufferedwriter.close(); os.close(); inputstream = httpurlconnection.getinputstream(); is.close(); return "registeration successfull........."; } catch (malformedurlexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } } return null; }
error message java.io.filenotfoundexception: http://192.168.0.101/kiranapp/register.php on line
inputstream = httpurlconnection.getinputstream();
Comments
Post a Comment