I found a lot of information on stack about this, but no one has done this to the end.
At the beginning i add to android manifest this:
<receiver android:name=".gps.GpsLocationReceiver">
<intent-filter>
<action android:name="android.location.PROVIDERS_CHANGED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
Next i trying to add a lot of code to my app.
At the beginning i implements to my activity LocationListner
According to the this: Detecting GPS on/off switch in Android phones
LocationListener should override this method:
@Override
public void onReceive(Context context, Intent intent)
{
if (intent.getAction().matches("android.location.PROVIDERS_CHANGED"))
{
// react on GPS provider change action
}
}
But in my app, LocationListner override only this method:
@Override
public void onLocationChanged(Location location) {
}
What is wrong with this androidstudio ? What i should do now ?