I have a MyBroadcastReceiver
setup like so:
<receiver android:name=".MyBroadcastReceiver">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PROVIDER_CHANGED" />
</intent-filter>
</receiver>
As you can see it "listens" for CONNECTIVITY_CHANGE
, WIFI_STATE_CHANGED
and PROVIDER_CHANGED
.
The first two are working great, and my BroadcastReceiver
gets called. However, it never gets called upon PROVIDER_CHANGED
(when I disable location on my Android 5.1).
MyBroadcastReceiver
is roughly this at the moment:
@Override
public void onReceive(final Context context, final Intent intent) {
final String action = intent.getAction();
Log.d("ACTION", action);
// ...
}
I tried different AndroidManifest.xml
configurations but never gets the PROVIDER_CHANGED
broadcast.
What am I doing wrong?
Oops, auto-completion made me use a wrong IntentFilter
action.
<action android:name="android.location.PROVIDERS_CHANGED" />
Should be used, not android.intent.action.PROVIDER_CHANGED
of course.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.