Android App runs only over Emulator -


i have following code sends phone location server through volley library, runs on emulators not on phone.

i can't investigate error anymore tried change minsdk leads nothing.

minsdk : 17

target : android nougat api 25 (7.1.1)

public class mainactivity extends appcompatactivity {  private button start, stop; private textview t; private locationmanager locationmanager; private locationlistener listener; private string url = "https://vamos.comeze.com/api/tracking";  @override protected void oncreate(@nullable bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      start = (button) findviewbyid(r.id.start);     stop = (button) findviewbyid(r.id.stop);     t = (textview) findviewbyid(r.id.textview);      locationmanager = (locationmanager) getsystemservice(location_service);       listener = new locationlistener() {         @override         public void onlocationchanged(final location location) {             t.settext("\n " + location.getlongitude() + " " + location.getlatitude());              stringrequest stringrequest = new stringrequest(request.method.post, url,                     new response.listener<string>() {                         @override                         public void onresponse(string response) {                          }                     }, new response.errorlistener() {                 @override                 public void onerrorresponse(volleyerror error) {                     toast.maketext(mainactivity.this, "error response", toast.length_short).show();                     log.e("hellllllllo", "error response");                 }             }) {                 @override                 protected map<string, string> getparams() throws authfailureerror {                     map<string, string> params = new hashmap<string, string>();                     params.put("longitude", location.getlongitude() + "");                     params.put("latitude", location.getlatitude() + "");                     log.e("longitude", location.getlongitude() + "");                     log.e("latitude", location.getlatitude() + "");                     return params;                 }             };             mysingleton.getinstance(mainactivity.this).addtorequestque(stringrequest);         }          @override         public void onstatuschanged(string s, int i, bundle bundle) {          }          @override         public void onproviderenabled(string s) {          }          @override         public void onproviderdisabled(string s) {             intent = new intent(settings.action_location_source_settings);             startactivity(i);         }     };     start.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {             log.e("start", "yes on start");             configure_button();         }     });      stop.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {             log.e("stop", "yes on stop");             locationmanager.removeupdates(listener);         }     }); }  @override public void onrequestpermissionsresult(int requestcode, @nonnull string[] permissions, @nonnull int[] grantresults) {     switch (requestcode) {         case 10:             configure_button();             break;         default:             break;     } }  void configure_button() {     // first check permissions     if (activitycompat.checkselfpermission(this, manifest.permission.access_fine_location) != packagemanager.permission_granted && activitycompat.checkselfpermission(this, manifest.permission.access_coarse_location) != packagemanager.permission_granted) {         if (build.version.sdk_int >= build.version_codes.m) {             requestpermissions(new string[]{manifest.permission.access_coarse_location, manifest.permission.access_fine_location, manifest.permission.internet}                     , 10);         }         return;     }     locationmanager.requestlocationupdates("gps", 5000, 1, listener);     } } 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -