Skip to content Skip to sidebar Skip to footer

Problem While Implement Location Listener In Android Appwidget

I am working on a Widget which will get the Current GPS location and pass this value to remote PHP page to get the Information and display it in the Widget. This is what I am tryin

Solution 1:

The problem I see is that you are trying to check curLocation in onStart() right after calling requestLocationUpdates(). LocationManager.requestLocationUpdates() is asynchronous, meaning your LocationListener will not get called back until after onStart() has returned. Have your LocationListener update the UI after it receives the location, don't try and do it in onStart.

Solution 2:

Are you having this problem in the emulator or on a device? If on the emulator, make sure you use DDMS to set a GPS location. But the easiest thing to do might be to run your code on a device to see if you get GPS updates that way.

Post a Comment for "Problem While Implement Location Listener In Android Appwidget"