Geofence transition PendingIntent blocked by the OS on Android Oreo

后端 未结 2 1044
鱼传尺愫
鱼传尺愫 2021-02-03 16:40

This only happens on Android Oreo. I\'m using Play Services 11.4.2. I\'m registering geofences using the GeofencingClient and the addGeofences method with a pendingIntent to an

2条回答
  •  南方客
    南方客 (楼主)
    2021-02-03 16:59

    In addition to switching to a BroadcastReceiver as mentioned in the accepted answer, I'd like to point out that although you will still receive BOOT_COMPLETED, you will not be able to receive PROVIDERS_CHANGED any longer.

    PROVIDERS_CHANGED is an implicit broadcast and is not in the list of broadcast exceptions.

    BOOT_COMPLETED is in the list of broadcast exceptions which is why you'll still receive it.

    If you want to learn about an alternative approach to get the hook when location services is toggled, please see my answer to a related question for more details.

提交回复
热议问题