Androids onStatusChanged não está funcionando
Estou tentando receber notificações se o status de GPS_PROVIDER for alterado. Eu encontrei o seguinte código aqui (http://hejp.co.uk/android/android-gps-example/), mas não estou recebendo notificações.
No momento estou em um prédio e não consigo sinal de GPS, então não recebo a notificação "Status alterado: fora de serviço"?Quando o onStatusChanged está sendo chamado?O que estou fazendo de errado?Obrigado,
@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;
}