retrofit - Android App not connecting to network which is on **localhost** and if trying to run on Real Mobile Phone -


i have created 1 android app communicate restful webservice using retrofit.it performing when running on **genymotion **,means sending request , getting respond back.

but when run on real mobile phone ,app running not sending request also.can tell me why happening ?

afteredit: when have

gson gson = new gsonbuilder()                   .setfieldnamingpolicy(fieldnamingpolicy.lower_case_with_underscores).create();      restadapter restadapter = new restadapter.builder()             .setendpoint("http://10.0.3.2:8082")             .setconverter(new gsonconverter(gson))             .build();     retrofitservice service = restadapter.create(retrofitservice.class);     try {          serverresponse serverresponse = service.checklogin(logindetails);  ...}  

where retrofit interface

public interface retrofitservice {  @headers({ "content-type: application/json" }) @post("/vendorwebapplication/userlogin") public serverresponse checklogin(@body logindetails logindetails);}  

now when caming service.checklogin(logindetails) expected should request respected web service,which happening correctly genymotion.but when running on mobile device ,it going upto serverresponse serverresponse = service.checklogin(logindetails); not requesting respected url , moving forward.

error:enter image description here

when trying run android app in connecting webservice on localhost,

make sure when running on genymotion,ip address should http://10.0.3.2:8082/uraddress or http://10.0.2.2:8082/uraddress

and when running on real mobile device,make sure mobile , pc should connected same network , instead of 10.0.3.2 insert pc's ip address


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -