A library that provides an API to launch Android intents.
expo-intent-launcher
provides a way to launch Android intents. For example, you can use this API to open a specific settings screen.
-
npx expo install expo-intent-launcher
If you are installing this in an existing React Native app, start by installing expo
in your project. Then, follow the additional instructions as mentioned by the library's README under "Installation in bare React Native projects" section.
import { startActivityAsync, ActivityAction } from 'expo-intent-launcher';
// Open location settings
startActivityAsync(ActivityAction.LOCATION_SOURCE_SETTINGS);
import * as IntentLauncher from 'expo-intent-launcher';
Parameter | Type | Description |
---|---|---|
activityAction | string | The action to be performed, e.g. |
params (optional) | IntentLauncherParams | An object of intent parameters. Default: {} |
Starts the specified activity. The method will return a promise which resolves when the user returns to the app.
A promise which fulfils with IntentLauncherResult
object.
IntentLauncherParams Properties
Name | Type | Description |
---|---|---|
category (optional) | string | Category provides more details about the action the intent performs. See Intent.addCategory. |
className (optional) | string | Class name of the ComponentName. |
data (optional) | string | A URI specifying the data that the intent should operate upon. (Note: Android requires the URI scheme to be lowercase, unlike the formal RFC.) |
extra (optional) | Record<string, any> | A map specifying additional key-value pairs which are passed with the intent as |
flags (optional) | number | Bitmask of flags to be used. See Intent.setFlags for more details. |
packageName (optional) | string | Package name used as an identifier of ComponentName. Set this only if you want to explicitly set the component to handle the intent. |
type (optional) | string | A string specifying the MIME type of the data represented by the data parameter. Ignore this argument to allow Android to infer the correct MIME type. |
IntentLauncherResult Properties
Name | Type | Description |
---|---|---|
data (optional) | string | Optional data URI that can be returned by the activity. |
extra (optional) | object | Optional extras object that can be returned by the activity. |
resultCode | ResultCode | Result code returned by the activity. |
Constants are from the source code of Settings provider.
ACCESSIBILITY_SETTINGS
ActivityAction.ACCESSIBILITY_SETTINGS = "android.settings.ACCESSIBILITY_SETTINGS"
APP_NOTIFICATION_REDACTION
ActivityAction.APP_NOTIFICATION_REDACTION = "android.settings.ACTION_APP_NOTIFICATION_REDACTION"
CONDITION_PROVIDER_SETTINGS
ActivityAction.CONDITION_PROVIDER_SETTINGS = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS"
NOTIFICATION_LISTENER_SETTINGS
ActivityAction.NOTIFICATION_LISTENER_SETTINGS = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"
AIRPLANE_MODE_SETTINGS
ActivityAction.AIRPLANE_MODE_SETTINGS = "android.settings.AIRPLANE_MODE_SETTINGS"
APP_NOTIFICATION_SETTINGS
ActivityAction.APP_NOTIFICATION_SETTINGS = "android.settings.APP_NOTIFICATION_SETTINGS"
APPLICATION_DETAILS_SETTINGS
ActivityAction.APPLICATION_DETAILS_SETTINGS = "android.settings.APPLICATION_DETAILS_SETTINGS"
APPLICATION_DEVELOPMENT_SETTINGS
ActivityAction.APPLICATION_DEVELOPMENT_SETTINGS = "android.settings.APPLICATION_DEVELOPMENT_SETTINGS"
BATTERY_SAVER_SETTINGS
ActivityAction.BATTERY_SAVER_SETTINGS = "android.settings.BATTERY_SAVER_SETTINGS"
DATA_ROAMING_SETTINGS
ActivityAction.DATA_ROAMING_SETTINGS = "android.settings.DATA_ROAMING_SETTINGS"
HARD_KEYBOARD_SETTINGS
ActivityAction.HARD_KEYBOARD_SETTINGS = "android.settings.HARD_KEYBOARD_SETTINGS"
IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS
ActivityAction.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS = "android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS"
IGNORE_BATTERY_OPTIMIZATION_SETTINGS
ActivityAction.IGNORE_BATTERY_OPTIMIZATION_SETTINGS = "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS"
INPUT_METHOD_SETTINGS
ActivityAction.INPUT_METHOD_SETTINGS = "android.settings.INPUT_METHOD_SETTINGS"
INPUT_METHOD_SUBTYPE_SETTINGS
ActivityAction.INPUT_METHOD_SUBTYPE_SETTINGS = "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS"
INTERNAL_STORAGE_SETTINGS
ActivityAction.INTERNAL_STORAGE_SETTINGS = "android.settings.INTERNAL_STORAGE_SETTINGS"
LOCATION_SOURCE_SETTINGS
ActivityAction.LOCATION_SOURCE_SETTINGS = "android.settings.LOCATION_SOURCE_SETTINGS"
MANAGE_ALL_APPLICATIONS_SETTINGS
ActivityAction.MANAGE_ALL_APPLICATIONS_SETTINGS = "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS"
MANAGE_APPLICATIONS_SETTINGS
ActivityAction.MANAGE_APPLICATIONS_SETTINGS = "android.settings.MANAGE_APPLICATIONS_SETTINGS"
MANAGE_DEFAULT_APPS_SETTINGS
ActivityAction.MANAGE_DEFAULT_APPS_SETTINGS = "android.settings.MANAGE_DEFAULT_APPS_SETTINGS"
NETWORK_OPERATOR_SETTINGS
ActivityAction.NETWORK_OPERATOR_SETTINGS = "android.settings.NETWORK_OPERATOR_SETTINGS"
NIGHT_DISPLAY_SETTINGS
ActivityAction.NIGHT_DISPLAY_SETTINGS = "android.settings.NIGHT_DISPLAY_SETTINGS"
NOTIFICATION_POLICY_ACCESS_SETTINGS
ActivityAction.NOTIFICATION_POLICY_ACCESS_SETTINGS = "android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS"
NOTIFICATION_SETTINGS
ActivityAction.NOTIFICATION_SETTINGS = "android.settings.NOTIFICATION_SETTINGS"
QUICK_LAUNCH_SETTINGS
ActivityAction.QUICK_LAUNCH_SETTINGS = "android.settings.QUICK_LAUNCH_SETTINGS"
REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
ActivityAction.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"
SHOW_ADMIN_SUPPORT_DETAILS
ActivityAction.SHOW_ADMIN_SUPPORT_DETAILS = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS"
SHOW_INPUT_METHOD_PICKER
ActivityAction.SHOW_INPUT_METHOD_PICKER = "android.settings.SHOW_INPUT_METHOD_PICKER"
SHOW_REMOTE_BUGREPORT_DIALOG
ActivityAction.SHOW_REMOTE_BUGREPORT_DIALOG = "android.settings.SHOW_REMOTE_BUGREPORT_DIALOG"
STORAGE_MANAGER_SETTINGS
ActivityAction.STORAGE_MANAGER_SETTINGS = "android.settings.STORAGE_MANAGER_SETTINGS"
SYSTEM_UPDATE_SETTINGS
ActivityAction.SYSTEM_UPDATE_SETTINGS = "android.settings.SYSTEM_UPDATE_SETTINGS"
TETHER_PROVISIONING_UI
ActivityAction.TETHER_PROVISIONING_UI = "android.settings.TETHER_PROVISIONING_UI"
TRUSTED_CREDENTIALS_USER
ActivityAction.TRUSTED_CREDENTIALS_USER = "android.settings.TRUSTED_CREDENTIALS_USER"
USAGE_ACCESS_SETTINGS
ActivityAction.USAGE_ACCESS_SETTINGS = "android.settings.USAGE_ACCESS_SETTINGS"
USER_DICTIONARY_INSERT
ActivityAction.USER_DICTIONARY_INSERT = "android.settings.USER_DICTIONARY_INSERT"
USER_DICTIONARY_SETTINGS
ActivityAction.USER_DICTIONARY_SETTINGS = "android.settings.USER_DICTIONARY_SETTINGS"
VOICE_CONTROL_AIRPLANE_MODE
ActivityAction.VOICE_CONTROL_AIRPLANE_MODE = "android.settings.VOICE_CONTROL_AIRPLANE_MODE"
VOICE_CONTROL_BATTERY_SAVER_MODE
ActivityAction.VOICE_CONTROL_BATTERY_SAVER_MODE = "android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE"
VOICE_CONTROL_DO_NOT_DISTURB_MODE
ActivityAction.VOICE_CONTROL_DO_NOT_DISTURB_MODE = "android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE"
ZEN_MODE_AUTOMATION_SETTINGS
ActivityAction.ZEN_MODE_AUTOMATION_SETTINGS = "android.settings.ZEN_MODE_AUTOMATION_SETTINGS"
ZEN_MODE_EVENT_RULE_SETTINGS
ActivityAction.ZEN_MODE_EVENT_RULE_SETTINGS = "android.settings.ZEN_MODE_EVENT_RULE_SETTINGS"
ZEN_MODE_EXTERNAL_RULE_SETTINGS
ActivityAction.ZEN_MODE_EXTERNAL_RULE_SETTINGS = "android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS"
ZEN_MODE_PRIORITY_SETTINGS
ActivityAction.ZEN_MODE_PRIORITY_SETTINGS = "android.settings.ZEN_MODE_PRIORITY_SETTINGS"