In my application, I want to use both providers.
This means that if gps is disabled, I want my application to switch to the network, and when gps is turned on to return it.
I use two LocationListener parameters to handle these two requests.
public void onStatusChanged(String provider, int status,Bundle extras)
switch (status) {
case LocationProvider.TEMPORARILY_UNAVAILABLE:
......
break;
case LocationProvider.OUT_OF_SERVICE
.....
break;
case LocationProvider.AVAILABLE
.....
break;
}
And in every listener I discover this status in onStatusChanged(). It turns out that this method will be used in the first shift (the network is disconnected), but when I turn it on again, it shows nothing. Why was it? The listener will not detect status all the time
Please help me, it would be better to send you a solution in code ... Thank you!
source
share