Connect android phone to pc localhost not working -


loading localhost in mobile browser works fine, loading xampp @ address https://192.168.100.53 not working android app.i have connected app online database @ 000webhost.com..it worked in case of localhost android app not working... following things done 1.pc , android mobile connected in same network 2.i have used pc ip address using ipconfig in run command 3.started apache

public class backgroundtask extends asynctask<string,void,string> {         @override         protected void onpreexecute()         {             super.onpreexecute();         }          @override         protected string doinbackground(string... params) {             string myurl = "https://192.168.100.53/phpandroid/gettd.php";             try {                 url url = new url(myurl);                 try {                      httpurlconnection httpurlconnection = (httpurlconnection) url.openconnection();                     httpurlconnection.setrequestmethod("post");                     httpurlconnection.setdooutput(true);                     httpurlconnection.setdoinput(true);                     outputstream os = httpurlconnection.getoutputstream();                     bufferedwriter bufferedwriter = new bufferedwriter(new outputstreamwriter(os,"utf-8"));                     string data = urlencoder.encode("profile_name","utf-8")+ "=" +urlencoder.encode("hello","utf-8");                     bufferedwriter.write(data);                     bufferedwriter.flush();                     bufferedwriter.close();                     os.close();                     inputstream = httpurlconnection.getinputstream();                     bufferedreader bufferedreader = new bufferedreader((new inputstreamreader(is,"utf-8")));                     string respond="";                     string row = "";                     while((row=bufferedreader.readline())!=null){                         respond =row;                     }                     bufferedreader.close();                     is.close();                     httpurlconnection.disconnect();                     return respond;                 } catch (ioexception e) {                     e.printstacktrace();                     // log.e("error","eroo @ http connection");                 }              } catch (malformedurlexception e) {                 e.printstacktrace();                 //log.e("erro","error @ url");             }             return  null;         }          @override         protected void onprogressupdate(void... values) {             super.onprogressupdate(values);         }          @override         protected void onpostexecute(string data) {             toast.maketext(getapplicationcontext(),data,toast.length_short).show();         }      } 


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -