I am calling the method and expect location updates multiple times:
locationManager.requestLocationUpdates("gps",0 ,0, loc_listener);
My loc_listener
is defined as:
LocationListener loc_listener = new LocationListener() {
private final String TAG = "xoxoxo.LocationListener";
public void onLocationChanged(Location l) {
Intent locationAlert = new Intent("xoxoxo.LOCATION_CHANGED")
.putExtra("target_location", l);
sendBroadcast(locationAlert);
// locationManager.requestLocationUpdates("gps", 0 ,0, this);
}
public void onProviderEnabled(String p) {
Log.i(TAG, "Provider enabled");
}
public void onProviderDisabled(String p) {
Log.i(TAG, "Provider disabled");
}
public void onStatusChanged(String p, int status, Bundle extras) {
Log.i(TAG, "Status changed");
}
};
Defined as is, I will only get an update once, both on HTC Evo 2.2 and 2.2 + Google API emulator.
The hack to get multiple updates is to uncomment the line which registers for updates on each update:
locationManager.requestLocationUpdates("gps", 0 ,0, this);
Have you guys seen anything like this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…