LocationManager.NETWORK_PROVIDER in API 9 and 10 in Android -


i trying out locationmanager.network_provider api 9 , 10 (2.3 , below 3.0). cannot latitude/longitude values if internet (wireless or data) off? not sure why?

it works fine on android 4.0 , more.

i using following:

locationlistenerfornetwork  = new mylocationlistenerfornetwork(); location.requestlocationupdates(locationmanager.network_provider, 0, 0, locationlistenerfornetwork );   private class mylocationlistenerfornetwork implements locationlistener   {     @override     public void onlocationchanged(location loc)      {                  //i required in place..             }    } } 

has had same issue?

try making call requestlocationupdates() different parameters.

make class implementing locationlistener, googleplayservicesclient.connectioncallbacks , googleplayservicesclient.onconnectionfailedlistener , add methods interfaces (onconnectionfailed(connectionresult connectionresult), onconnected() , ondisconnected()).

then, create locationrequest , locationclient:

 // create new global location parameters object     locationrequest mlocationrequest = locationrequest.create();      /*      * set update interval      */     mlocationrequest.setinterval(locationutils.update_interval_in_milliseconds);      // use high accuracy     mlocationrequest.setpriority(locationrequest.priority_high_accuracy);      // set interval ceiling 1 minute     mlocationrequest.setfastestinterval(locationutils.fast_interval_ceiling_in_milliseconds);      /*      * create new location client, using enclosing class      * handle callbacks.      */     locationclient mlocationclient = new locationclient(this, this, this); 

finally, make call update requests:

mlocationclient.requestlocationupdates(mlocationrequest, this); 

hope helps you.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -