Required 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
getPlaces() android.permission.ACCESS_FINE_LOCATION
getWeather() 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