Declare permissions on Android and iOS¶
An app that uses the camera, the microphone, location, Bluetooth, or the photo library must declare it on each platform. The two platforms declare it differently:
- Android lists permissions in the app manifest. You write them in
[tool.kivy.android.permissions].uses. - iOS needs a usage description in
Info.plist: the sentence iOS shows when it asks the user for access. You write it in[tool.kivy.ios.info_plist].
kivyforge has no shared permissions table, because the names, version rules and flags differ between the platforms. This page lists what to write in each overlay for the common capabilities.
Before you begin¶
Common capabilities¶
| Capability | Android uses entries |
iOS info_plist keys |
|---|---|---|
| Camera | "CAMERA" |
NSCameraUsageDescription |
| Microphone | "RECORD_AUDIO" |
NSMicrophoneUsageDescription |
| Approximate location | "ACCESS_COARSE_LOCATION" |
NSLocationWhenInUseUsageDescription, and NSLocationDefaultAccuracyReduced = true (see Location) |
| Precise location | "ACCESS_FINE_LOCATION" and "ACCESS_COARSE_LOCATION" |
NSLocationWhenInUseUsageDescription |
| Location in the background | Add "ACCESS_BACKGROUND_LOCATION" to one of the location rows above |
NSLocationWhenInUseUsageDescription, NSLocationAlwaysAndWhenInUseUsageDescription, and UIBackgroundModes = ["location"] |
| Bluetooth | See Bluetooth | NSBluetoothAlwaysUsageDescription |
| Contacts | "READ_CONTACTS" |
NSContactsUsageDescription |
| Notifications | "POST_NOTIFICATIONS" |
Nothing to declare. Push notifications need the aps-environment entitlement; see Run code in the iOS app lifecycle |
| Internet | "INTERNET" |
Nothing to declare |
For photos, see Photos: which entries you need depends on whether your app picks, reads, or saves photos.
An app that uses the camera and precise location declares:
[tool.kivy.android.permissions]
uses = ["CAMERA", "ACCESS_FINE_LOCATION", "ACCESS_COARSE_LOCATION"]
[tool.kivy.ios.info_plist]
NSCameraUsageDescription = "Scan the QR code on your ticket."
NSLocationWhenInUseUsageDescription = "Show your position on the map."
Write each iOS description as the reason your app needs access, not as a description of the permission. App Review rejects vague descriptions. If the description key is missing, iOS does not ask the user. For the camera, iOS terminates the app when it requests access. For location, iOS logs a warning and ignores the request, so the app never gets access. Android shows its own fixed text and has no description to set.
Location¶
On Android 12 and later, an app that asks for precise location must also ask for approximate location, because the user can choose to grant only approximate location. Declare both.
iOS has one location usage description for both accuracies. The user chooses
precise or approximate location when iOS asks, and can change it later in
Settings, so your app must work with either. CLLocationManager's
accuracyAuthorization tells your app which one it has.
NSLocationDefaultAccuracyReduced = true asks iOS to start the prompt at
approximate location. Do not rely on it: on iOS 27.2 the prompt still started
at precise location with this key set. Check the prompt on a device.
Location in the background needs extra review on both platforms:
- On Android,
ACCESS_BACKGROUND_LOCATIONdoes nothing without one of the foreground location permissions. Your app must request it separately, after the foreground permission is granted. Google Play also requires a declaration explaining why your app needs it. - On iOS,
UIBackgroundModes = ["location"]is needed only for continuous location updates while the app is in the background. Region monitoring and significant-change updates work without it.
Bluetooth¶
Android 12 (API 31) replaced the old Bluetooth permissions with new ones. An app
that supports earlier versions declares the old ones with max_sdk_version, so
they are requested only on the versions that use them:
[tool.kivy.android.permissions]
uses = [
{ name = "BLUETOOTH", max_sdk_version = 30 },
{ name = "BLUETOOTH_ADMIN", max_sdk_version = 30 },
{ name = "ACCESS_FINE_LOCATION", max_sdk_version = 30 },
"BLUETOOTH_CONNECT",
{ name = "BLUETOOTH_SCAN", uses_permission_flags = "neverForLocation" },
]
[tool.kivy.ios.info_plist]
NSBluetoothAlwaysUsageDescription = "Connect to your heart-rate monitor."
neverForLocationtells Android 12 and later that your app never uses Bluetooth scans to find the user's location, so scanning works without a location permission. If your app does derive location from scans, leave the flag out and declare location permissions without a cap.- Android 11 and earlier need location permission for any Bluetooth scan, which
is what the capped
ACCESS_FINE_LOCATIONentry is for. - Leave out
BLUETOOTH_SCANand the location entry if your app only connects to devices that are already paired. Add"BLUETOOTH_ADVERTISE"if your app makes the device discoverable to others.
uses_permission_flags needs compile_sdk 31 or higher. kivyforge rejects a
max_sdk_version below min_sdk, because no device the app installs on would
receive that permission.
Photos¶
| What your app does | Android uses entries |
iOS info_plist keys |
|---|---|---|
| Lets the user pick photos with the system picker | Nothing to declare | Nothing to declare |
| Saves photos to the library | { name = "WRITE_EXTERNAL_STORAGE", max_sdk_version = 28 } |
NSPhotoLibraryAddUsageDescription |
| Reads the whole library | "READ_MEDIA_IMAGES", "READ_MEDIA_VISUAL_USER_SELECTED", and { name = "READ_EXTERNAL_STORAGE", max_sdk_version = 32 } |
NSPhotoLibraryUsageDescription |
Prefer the system picker when you can. On Android, Google Play allows
READ_MEDIA_IMAGES only for apps whose core purpose needs broad photo access.
READ_MEDIA_VISUAL_USER_SELECTED lets Android 14 and later users grant access
to only some photos. Add "READ_MEDIA_VIDEO" if your app also reads videos.
Ask at run time¶
A declaration only makes a permission available to ask for. Your app still has to ask for the permissions Android calls dangerous, such as the camera, microphone, location, contacts and the Bluetooth permissions, while it runs:
- On Android, use
request_permissionsfrom the bundledandroidpackage. See Use the android package. - On iOS, the system asks when your app first requests access, for example
with
requestWhenInUseAuthorizationfor location. It asks only once. The answer stands until the app is deleted or the user changes it in Settings.
Verify¶
Build the app and check the generated declarations:
kivyforge build -p android --debug
Open <app>-android/app/src/main/AndroidManifest.xml, where <app> is your
[project].name, and check the <uses-permission> elements, including
their android:maxSdkVersion and android:usesPermissionFlags attributes.
kivyforge build -p ios --simulator
Open <app>-ios/<app>-Info.plist and check the usage description keys.
Then run the app and use each capability once, to confirm that the system asks for access.
iOS asks only once per install. To see its prompt again, delete the app, or on the simulator run:
xcrun simctl privacy booted reset all BUNDLE_ID
Replace BUNDLE_ID with your [tool.kivy.ios].bundle_id. The simulator's
location prompt has no map or Precise control, so check location accuracy on a
device.