Thursday, 15 March 2012

android - GPS won't turn on using LocationManager/LocationListener -



android - GPS won't turn on using LocationManager/LocationListener -

i'm developping simple application monitor gps speed. morning installed couple of gps position mockers test application , no 1 seemed work well. uninstalled of them , (i don't know if related @ point) when debug application on n4 using adb, gps won't turn on when phone call .requestlocationupdates. gps icon doesn't show in notification bar , no info retrieved, onlicationchanged never called , function .isprovider enabled returns false..

i completly reconstructed application simplest form possible. phone call code copied android.developper documentation straight on oncreate override.

@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_speed_monitoring); // acquire reference scheme location manager locationmanager locationmanager = (locationmanager) .getsystemservice(context.location_service); // define listener responds location updates locationlistener locationlistener = new locationlistener() { public void onlocationchanged(location location) { location.getlatitude(); toast.maketext(getapplicationcontext(), "current speed:" + location.getspeed(), toast.length_short).show(); } public void onstatuschanged(string provider, int status, bundle extras) { } public void onproviderenabled(string provider) { } public void onproviderdisabled(string provider) { } }; locationmanager.requestlocationupdates(locationmanager.gps_provider, 0, 1000, locationlistener); }

now i'm wondering if related code or android device, or both. tested google maps , trigger's gps icon , find location without problem, i'm testing on android simulator now, maintain updated.

oh , also, i'm unsing android studio.

thank you.

edit: gps icon triggered on emulator, might setting in phone, can cause this? , why other gps applications work?

edit 2 : application works fine on emulator, update location via telnet geo prepare , works charm..

there may pretty simple solution , i'm sorry when you've considered this, restarting phone magic me.

a little explanation: worked couple of months on location aware service , stumbling upon kind of errors well. seems @ point google updates it's libraries in background , restart can create work 1 time again then. had 6 nexus5 phones exact same errors , restart did job of them.

android gps locationmanager locationlistener nexus-4

No comments:

Post a Comment