Permission Prompts for the Android SDK
Request additional system permissions (e.g., location) from users using Opt-in Actions.
The Airship SDK automatically handles push notification permissions. For additional permissions like location, you can use Opt-in Actions to prompt users using native permission prompts.
Opt-in Actions are a special type of ActionA configurable behavior that occurs when a user interacts with your message, e.g., opening a web page. that are handled by PermissionsManager. For an overview of all supported actions and where they are available, see the Actions guide.
Supported Opt-in Types
- Push — Handled automatically by the SDK (no implementation needed)
- Location — Requires implementing a custom
PermissionDelegate
Implementing Location Opt-in
To implement Location Opt-in, create a custom PermissionDelegate and register it with PermissionsManager to handle location permissions.
Create a Location Permission Delegate
Creating a location permission delegate
val delegate = SinglePermissionDelegate(Manifest.permission.ACCESS_COARSE_LOCATION)For fine location, use Manifest.permission.ACCESS_FINE_LOCATION instead.
SinglePermissionDelegate delegate = new SinglePermissionDelegate(Manifest.permission.ACCESS_COARSE_LOCATION);For fine location, use Manifest.permission.ACCESS_FINE_LOCATION instead.
Register the Permission Delegate
After creating a location PermissionDelegate, register it with PermissionsManager after Airship is ready:
Registering the permission delegate
Airship.permissionsManager
.setPermissionDelegate(Permission.LOCATION, delegate)Airship.getPermissionsManager()
.setPermissionDelegate(Permission.LOCATION, delegate);Categories