Wymagane uprawnienia
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Aplikacja musi deklarować uprawnienia dla każdej używanej metody interfejsu API. Wymagane uprawnienia mogą się różnić. Zależy to od metod interfejsu API i typów ogrodzenia używanych przez Twoją aplikację. Aby dowiedzieć się, które uprawnienia są wymagane w przypadku każdej metody, zapoznaj się z tą dokumentacją.
Snapshot API
Tabela poniżej zawiera uprawnienia wymagane dla każdej metody interfejsu Snapshot API:
Metoda |
Wymagane uprawnienia Androida |
getDetectedActivity() |
android.permission.ACTIVITY_RECOGNITION
com.google.android.gms.permission.ACTIVITY_RECOGNITION (Android 9 (poziom API 28))
|
getBeaconState() |
android.permission.ACCESS_FINE_LOCATION |
getHeadphoneState() |
brak |
getLocation() |
android.permission.ACCESS_FINE_LOCATION |
Fence API
Tabela poniżej zawiera uprawnienia wymagane dla każdego typu ogrodzenia w Fence API:
Typ ogrodzenia w Fence API |
Wymagane uprawnienia Androida |
DetectedActivityFence |
android.permission.ACTIVITY_RECOGNITION
com.google.android.gms.permission.ACTIVITY_RECOGNITION (Android 9 (poziom API 28))
|
BeaconFence |
android.permission.ACCESS_FINE_LOCATION |
HeadphoneFence |
brak |
LocationFence |
android.permission.ACCESS_FINE_LOCATION |
TimeFence |
brak |
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-08-31 UTC.
[null,null,["Ostatnia aktualizacja: 2025-08-31 UTC."],[[["\u003cp\u003eYour app must declare permissions for each Awareness API method used, with specific permissions varying based on the method and fence type.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the provided documentation to identify the necessary permissions for each Awareness API method.\u003c/p\u003e\n"],["\u003cp\u003eThe Snapshot API requires specific permissions for accessing detected activities, beacon state, and location, while headphone state requires no permission.\u003c/p\u003e\n"],["\u003cp\u003eThe Fence API requires specific permissions for activity, beacon, and location fences, while headphone and time fences require no permission.\u003c/p\u003e\n"]]],["Apps must declare permissions for each API method used, varying by method and fence type. The `getDetectedActivity()` Snapshot API method and `DetectedActivityFence` require `android.permission.ACTIVITY_RECOGNITION` and `com.google.android.gms.permission.ACTIVITY_RECOGNITION`. `getBeaconState()`, `getLocation()`, `BeaconFence`, and `LocationFence` require `android.permission.ACCESS_FINE_LOCATION`. `getHeadphoneState()`, `HeadphoneFence`, and `TimeFence` require no specific permissions. Consult the documentation for specific method permission requirements.\n"],null,["# Required permissions\n\nYour app must declare permissions for each API method that's used. The\nrequired permissions vary. It depends on the API methods and fence types\nused by your app. Reference this documentation to learn which permissions are\nrequired for each method.\n\nSnapshot API\n------------\n\nThe following table shows the permissions required for each Snapshot API\nmethod:\n\n| Method | Required Android permission |\n|-------------------------|-------------------------------------------------------------------------------------------------------------------------------|\n| `getDetectedActivity()` | `android.permission.ACTIVITY_RECOGNITION` `com.google.android.gms.permission.ACTIVITY_RECOGNITION` (Android 9 (API level 28)) |\n| `getBeaconState()` | `android.permission.ACCESS_FINE_LOCATION` |\n| `getHeadphoneState()` | none |\n| `getLocation()` | `android.permission.ACCESS_FINE_LOCATION` |\n\nFence API\n---------\n\nThe following table shows the permissions required for each Fence API fence\ntype:\n\n| Fence API fence type | Required Android permission |\n|-------------------------|-------------------------------------------------------------------------------------------------------------------------------|\n| `DetectedActivityFence` | `android.permission.ACTIVITY_RECOGNITION` `com.google.android.gms.permission.ACTIVITY_RECOGNITION` (Android 9 (API level 28)) |\n| `BeaconFence` | `android.permission.ACCESS_FINE_LOCATION` |\n| `HeadphoneFence` | none |\n| `LocationFence` | `android.permission.ACCESS_FINE_LOCATION` |\n| `TimeFence` | none |"]]