geolocation - Android: get current location of user without using gps or internet -


is possible current location of user without using gps or internet? mean of mobile network provider. can me?

what looking position using locationmanager.network_provider instead of locationmanager.gps_provider. network_provider resolve on gsm or wifi, ever available. wifi off, gsm used. keep in mind using cell network accurate 500m.

http://developer.android.com/guide/topics/location/obtaining-user-location.html has great information , sample code.

after done of code in oncreate(), add this:

// acquire reference system location manager locationmanager locationmanager = (locationmanager) this.getsystemservice(context.location_service);  // define listener responds location updates locationlistener locationlistener = new locationlistener() {     public void onlocationchanged(location location) {       // called when new location found network location provider.       makeuseofnewlocation(location);     }      public void onstatuschanged(string provider, int status, bundle extras) {}      public void onproviderenabled(string provider) {}      public void onproviderdisabled(string provider) {}   };  // register listener location manager receive location updates locationmanager.requestlocationupdates(locationmanager.network_provider, 0, 0, locationlistener); 

you have activity implement locationlistener class , implement onlocationchanged() in activity.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -