Required permissions

  • Apps must declare permissions for each API method used, and the required permissions vary depending on the API methods and fence types.

  • The Snapshot API methods getDetectedActivity(), getBeaconState(), and getLocation() require specific Android permissions.

  • The Fence API fence types DetectedActivityFence, BeaconFence, and LocationFence require specific Android permissions.

  • Some methods like getHeadphoneState() in the Snapshot API and HeadphoneFence and TimeFence in the Fence API do not require any permissions.

Your app must declare permissions for each API method that's used. The required permissions vary. It depends on the API methods and fence types used by your app. Reference this documentation to learn which permissions are required for each method.

Snapshot API

The following table shows the permissions required for each Snapshot API method:

Method Required Android permission
getDetectedActivity()

android.permission.ACTIVITY_RECOGNITION

com.google.android.gms.permission.ACTIVITY_RECOGNITION (Android 9 (API level 28))

getBeaconState() android.permission.ACCESS_FINE_LOCATION
getHeadphoneState() none
getLocation() android.permission.ACCESS_FINE_LOCATION

Fence API

The following table shows the permissions required for each Fence API fence type:

Fence API fence type Required Android permission
DetectedActivityFence

android.permission.ACTIVITY_RECOGNITION

com.google.android.gms.permission.ACTIVITY_RECOGNITION (Android 9 (API level 28))

BeaconFence android.permission.ACCESS_FINE_LOCATION
HeadphoneFence none
LocationFence android.permission.ACCESS_FINE_LOCATION
TimeFence none