#StackBounty: #android #broadcastreceiver LocationManager.PROVIDERS_CHANGED_ACTION will not work on API 26 and higher

Bounty: 50

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. Ref: Background Execution Limits.

So how can I achieve the same task in API 26 and higher?

Any solution/suggestion will be highly appreciated.

Note : I need to re register the geofences even app is in background.


Get this bounty!!!

Leave a Reply