I'm trying to get notifications if the status of GPS_PROVIDER changes. I found the following code here (http://hejp.co.uk/android/android-gps-example/), but I'm not getting notifications.
- Right now I'm in a building and can't get GPS signal, so wouldn't I get the notification "Status Changed: Out of Service"?
- When is onStatusChanged being called?
- What am I doing wrong?
Thanks,
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
/* This is called when the GPS status alters */
switch (status) {
case LocationProvider.OUT_OF_SERVICE:
Log.v(tag, "Status Changed: Out of Service");
Toast.makeText(this, "Status Changed: Out of Service",
Toast.LENGTH_SHORT).show();
break;
case LocationProvider.TEMPORARILY_UNAVAILABLE:
Log.v(tag, "Status Changed: Temporarily Unavailable");
Toast.makeText(this, "Status Changed: Temporarily Unavailable",
Toast.LENGTH_SHORT).show();
break;
case LocationProvider.AVAILABLE:
Log.v(tag, "Status Changed: Available");
Toast.makeText(this, "Status Changed: Available",
Toast.LENGTH_SHORT).show();
break;
}