I am using following code to get location on/off event.
<receiver
android:name=".receivers.GpsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.location.PROVIDERS_CHANGED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
I am developing geofence based app. Based on Re-register geofences only when required we have to re register the geofences after the app has received a GEOFENCE_NOT_AVAILABLE alert. This typically happens after NLP (Android's Network Location Provider) is disabled.
By using this broadcast receiver I re-registered the geofences when Android's Network Location Provider is enabled.
But from API level 26 this broadcast receiver will never work. See Background Execution Limits.
So how can I achieve the same task in API 26 and higher?
Note : I need to re-register the geofences even when app is in the background.