OnLocationChanged callback is never called

It looks like you setup should work, since it doesn’t, I would make your example as simple as possible in order to troubleshoot. I would make your request look like

requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);

This way you get ALL the updates possible. And comment out the part about getting the last known location. It’s not needed yet.

Then in onLocationChanged(), just have

Log.v(TAG, "IN ON LOCATION CHANGE, lat=" + latitude + ", lon=" + longitude);

Comment out the rest so that you keep your listener active. This should give you a stream of updates on a real device. On the emulator, you’ll need to use DDMS, and you’ll get one GPS update each time you press send.

Leave a Comment