Permissions Overview

Learn how to manage device permissions in, including camera, location, and contacts.

Mobile app permissions play a critical role in ensuring secure interaction between users and applications. They serve as a framework that enables apps to access specific features or data on a user's device, such as the camera, microphone, location, or contact list, and allow the user to retain complete control over their privacy and data security.

By granting these permissions, users allow apps to deliver tailored functionalities and enhance their overall experience. Some Native Plugins may require certain device permissions to fulfill their use case.

Apple and Google encourage developers to request permission thoughtfully. If a user has declined, you can suggest they enable the permission through the app's settings menu and include a button that launches the app settings screen using the JavaScript Bridge.

Related Documentation

Permission Prompts

When requesting permissions from your users, they will be asked to provide their consent. Those prompts are native app components with very limited customization.

  • iOS: iOS allows a customizable usage description for permission prompts, enabling developers to explain how the requested data will be used. You can follow Permission Prompt Localization to localize the usage description.
  • Android: Android permission prompts are served from the system and are translated to the device language. No additional customization is supported.

JavaScript Bridge Functions

Permissions Status


👍

Developer Demo

Display our demo page in your app to test during development permissions demo page

Users can change the permissions granted to your app through their device settings. You can programmatically check the status of permissions using the Median JavaScript Bridge:

// get status of all permissions
const response = await median.permissions.status();

// only get status of selected permissions
const response = await median.permissions.status(['Contacts', 'Camera']);

The response object includes the current state for each requested permission:

{
  "Contacts": "undetermined",
  "Camera": "granted"
}

Each permission can have the following states:

  • denied: The permission has been denied or revoked; it can be asked for again.
  • granted: The permission has been granted.
  • undetermined: The permission was never asked (iOS only).

Status can be fetched for the following permission types:

  • PhotoLibrary (iOS only)
  • AppTrackingTransparency (iOS only)
  • LocationAlways
  • LocationWhenInUse
  • Microphone
  • Contacts
  • Camera
  • Notifications

App Settings

👍

Developer Demo

Test launching the app settings menu: median.dev/app-settings

When users have denied permissions, you can direct them to the app's settings page to enable the required permissions:

median.open.appSettings();

To open the Settings page for your app, use the URL above or the JavaScript Bridge call.

You can also review app permissions on device following the official guides:

Summary

Some device hardware and functionality requires specific permissions from the user. Permission requests can be configured to prompt when the app is first launched or in-context when required at runtime via the JavaScript Bridge. If a user has declined, suggest they enable the permission through the app's settings menu and provide a button that launches the app settings screen using median.open.appSettings().