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.
Installation
- npx expo install expo-intent-launcherIf you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
import { startActivityAsync, ActivityAction } from 'expo-intent-launcher'; // Open location settings startActivityAsync(ActivityAction.LOCATION_SOURCE_SETTINGS);
API
import * as IntentLauncher from 'expo-intent-launcher';
Methods
| Parameter | Type | Description |
|---|---|---|
| packageName | string | The package name of the target application. For example, |
Returns the icon of the specified application as a base64-encoded PNG image string.
The returned string is prefixed with data:image/png;base64, and can be used directly in an expo-image's Image.source prop.
Promise<string>A promise that resolves to the base64-encoded PNG icon of the specified application, or an empty string if the icon could not be retrieved.
| Parameter | Type | Description |
|---|---|---|
| packageName | string | For example: |
Opens an application by its package name.
void| Parameter | Type | Description |
|---|---|---|
| activityAction | string | The action to be performed, for example, |
| 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.
Promise<IntentLauncherResult>A promise which fulfils with IntentLauncherResult object.
Interfaces
| Property | Type | Description |
|---|---|---|
| category(optional) | string | Category provides more details about the action the intent performs. See |
| 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 |
| 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. |
| Property | 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. |
Enums
Constants are from the source code of Settings provider.
ActivityAction.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS = "android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS"ActivityAction.ACCESSIBILITY_COLOR_MOTION_SETTINGS = "android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS"ActivityAction.ACCESSIBILITY_DETAILS_SETTINGS = "android.settings.ACCESSIBILITY_DETAILS_SETTINGS"ActivityAction.ACCESSIBILITY_SETTINGS = "android.settings.ACCESSIBILITY_SETTINGS"ActivityAction.ACCESSIBILITY_SETTINGS_FOR_SUW = "android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW"ActivityAction.ACCESSIBILITY_SHORTCUT_SETTINGS = "android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS"ActivityAction.ACCOUNT_SYNC_SETTINGS = "android.settings.ACCOUNT_SYNC_SETTINGS"ActivityAction.APP_NOTIFICATION_REDACTION = "android.settings.ACTION_APP_NOTIFICATION_REDACTION"ActivityAction.CONDITION_PROVIDER_SETTINGS = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS"ActivityAction.MEDIA_CONTROLS_SETTINGS = "android.settings.ACTION_MEDIA_CONTROLS_SETTINGS"ActivityAction.NOTIFICATION_LISTENER_SETTINGS = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"ActivityAction.OTHER_SOUND_SETTINGS = "android.settings.ACTION_OTHER_SOUND_SETTINGS"ActivityAction.POWER_MENU_SETTINGS = "android.settings.ACTION_POWER_MENU_SETTINGS"ActivityAction.MANAGE_OVERLAY_PERMISSION = "android.settings.action.MANAGE_OVERLAY_PERMISSION"ActivityAction.MANAGE_WRITE_SETTINGS = "android.settings.action.MANAGE_WRITE_SETTINGS"ActivityAction.ONE_HANDED_SETTINGS = "android.settings.action.ONE_HANDED_SETTINGS"ActivityAction.ADAPTIVE_BRIGHTNESS_SETTINGS = "android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS"ActivityAction.ADVANCED_MEMORY_PROTECTION_SETTINGS = "android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS"ActivityAction.AIRPLANE_MODE_SETTINGS = "android.settings.AIRPLANE_MODE_SETTINGS"ActivityAction.ALL_APPS_NOTIFICATION_SETTINGS = "android.settings.ALL_APPS_NOTIFICATION_SETTINGS"ActivityAction.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW = "android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW"ActivityAction.APP_NOTIFICATION_BUBBLE_SETTINGS = "android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS"ActivityAction.APP_NOTIFICATION_SETTINGS = "android.settings.APP_NOTIFICATION_SETTINGS"ActivityAction.APP_OPEN_BY_DEFAULT_SETTINGS = "android.settings.APP_OPEN_BY_DEFAULT_SETTINGS"ActivityAction.APPLICATION_DETAILS_SETTINGS = "android.settings.APPLICATION_DETAILS_SETTINGS"ActivityAction.APPLICATION_DEVELOPMENT_SETTINGS = "android.settings.APPLICATION_DEVELOPMENT_SETTINGS"ActivityAction.AUTOMATIC_ZEN_RULE_SETTINGS = "android.settings.AUTOMATIC_ZEN_RULE_SETTINGS"ActivityAction.BATTERY_SAVER_SETTINGS = "android.settings.BATTERY_SAVER_SETTINGS"ActivityAction.BLUETOOTH_DASHBOARD_SETTINGS = "android.settings.BLUETOOTH_DASHBOARD_SETTINGS"ActivityAction.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER = "android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER"ActivityAction.BLUETOOTH_PAIRING_SETTINGS = "android.settings.BLUETOOTH_PAIRING_SETTINGS"ActivityAction.BLUTOOTH_FIND_BROADCASTS_ACTIVITY = "android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY"ActivityAction.BUGREPORT_HANDLER_SETTINGS = "android.settings.BUGREPORT_HANDLER_SETTINGS"ActivityAction.CELLULAR_NETWORK_SECURITY = "android.settings.CELLULAR_NETWORK_SECURITY"ActivityAction.CHANNEL_NOTIFICATION_SETTINGS = "android.settings.CHANNEL_NOTIFICATION_SETTINGS"ActivityAction.COLOR_INVERSION_SETTINGS = "android.settings.COLOR_INVERSION_SETTINGS"ActivityAction.COMBINED_BIOMETRICS_SETTINGS = "android.settings.COMBINED_BIOMETRICS_SETTINGS"ActivityAction.CONVERSATION_SETTINGS = "android.settings.CONVERSATION_SETTINGS"ActivityAction.DATA_ROAMING_SETTINGS = "android.settings.DATA_ROAMING_SETTINGS"ActivityAction.DEVELOPMENT_START_DSU_LOADER = "android.settings.development.START_DSU_LOADER"ActivityAction.ENTERPRISE_PRIVACY_SETTINGS = "android.settings.ENTERPRISE_PRIVACY_SETTINGS"ActivityAction.FINGERPRINT_SETTINGS_V2 = "android.settings.FINGERPRINT_SETTINGS_V2"ActivityAction.FIRST_DAY_OF_WEEK_SETTINGS = "android.settings.FIRST_DAY_OF_WEEK_SETTINGS"ActivityAction.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS = "android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS"ActivityAction.HARD_KEYBOARD_SETTINGS = "android.settings.HARD_KEYBOARD_SETTINGS"ActivityAction.HEARING_DEVICES_PAIRING_SETTINGS = "android.settings.HEARING_DEVICES_PAIRING_SETTINGS"ActivityAction.HEARING_DEVICES_SETTINGS = "android.settings.HEARING_DEVICES_SETTINGS"ActivityAction.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS = "android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS"ActivityAction.IGNORE_BATTERY_OPTIMIZATION_SETTINGS = "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS"ActivityAction.INPUT_METHOD_SETTINGS = "android.settings.INPUT_METHOD_SETTINGS"ActivityAction.INPUT_METHOD_SUBTYPE_SETTINGS = "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS"ActivityAction.INTERNAL_STORAGE_SETTINGS = "android.settings.INTERNAL_STORAGE_SETTINGS"ActivityAction.LOCATION_SCANNING_SETTINGS = "android.settings.LOCATION_SCANNING_SETTINGS"ActivityAction.LOCATION_SOURCE_SETTINGS = "android.settings.LOCATION_SOURCE_SETTINGS"ActivityAction.MANAGE_ADAPTIVE_NOTIFICATIONS = "android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS"ActivityAction.MANAGE_ALL_APPLICATIONS_SETTINGS = "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS"ActivityAction.MANAGE_ALL_FILES_ACCESS_PERMISSION = "android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION"ActivityAction.MANAGE_ALL_SIM_PROFILES_SETTINGS = "android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS"ActivityAction.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION = "android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION"ActivityAction.MANAGE_APP_LONG_RUNNING_JOBS = "android.settings.MANAGE_APP_LONG_RUNNING_JOBS"ActivityAction.MANAGE_APP_OVERLAY_PERMISSION = "android.settings.MANAGE_APP_OVERLAY_PERMISSION"ActivityAction.MANAGE_APP_USE_FULL_SCREEN_INTENT = "android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT"ActivityAction.MANAGE_APPLICATIONS_SETTINGS = "android.settings.MANAGE_APPLICATIONS_SETTINGS"ActivityAction.MANAGE_CLONED_APPS_SETTINGS = "android.settings.MANAGE_CLONED_APPS_SETTINGS"ActivityAction.MANAGE_CROSS_PROFILE_ACCESS = "android.settings.MANAGE_CROSS_PROFILE_ACCESS"ActivityAction.MANAGE_DEFAULT_APPS_SETTINGS = "android.settings.MANAGE_DEFAULT_APPS_SETTINGS"ActivityAction.MANAGE_UNKNOWN_APP_SOURCES = "android.settings.MANAGE_UNKNOWN_APP_SOURCES"ActivityAction.MANAGE_USER_ASPECT_RATIO_SETTINGS = "android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS"ActivityAction.MANAGED_PROFILE_SETTINGS = "android.settings.MANAGED_PROFILE_SETTINGS"ActivityAction.MEDIA_BROADCAST_DIALOG = "android.settings.MEDIA_BROADCAST_DIALOG"ActivityAction.NETWORK_OPERATOR_SETTINGS = "android.settings.NETWORK_OPERATOR_SETTINGS"ActivityAction.NETWORK_PROVIDER_SETTINGS = "android.settings.NETWORK_PROVIDER_SETTINGS"ActivityAction.NIGHT_DISPLAY_SETTINGS = "android.settings.NIGHT_DISPLAY_SETTINGS"ActivityAction.NOTIFICATION_ASSISTANT_SETTINGS = "android.settings.NOTIFICATION_ASSISTANT_SETTINGS"ActivityAction.NOTIFICATION_LISTENER_DETAIL_SETTINGS = "android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS"ActivityAction.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS = "android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS"ActivityAction.NOTIFICATION_POLICY_ACCESS_SETTINGS = "android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS"ActivityAction.NOTIFICATION_SETTINGS = "android.settings.NOTIFICATION_SETTINGS"ActivityAction.PANEL_INTERNET_CONNECTIVITY = "android.settings.panel.action.INTERNET_CONNECTIVITY"ActivityAction.PICTURE_IN_PICTURE_SETTINGS = "android.settings.PICTURE_IN_PICTURE_SETTINGS"ActivityAction.PRIVACY_ADVANCED_SETTINGS = "android.settings.PRIVACY_ADVANCED_SETTINGS"ActivityAction.PROCESS_WIFI_EASY_CONNECT_URI = "android.settings.PROCESS_WIFI_EASY_CONNECT_URI"ActivityAction.REDUCE_BRIGHT_COLORS_SETTINGS = "android.settings.REDUCE_BRIGHT_COLORS_SETTINGS"ActivityAction.REGIONAL_PREFERENCES_SETTINGS = "android.settings.REGIONAL_PREFERENCES_SETTINGS"ActivityAction.REMOTE_AUTHENTICATOR_ENROLL = "android.settings.REMOTE_AUTHENTICATOR_ENROLL"ActivityAction.REQUEST_ENABLE_CONTENT_CAPTURE = "android.settings.REQUEST_ENABLE_CONTENT_CAPTURE"ActivityAction.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"ActivityAction.REQUEST_MEDIA_ROUTING_CONTROL = "android.settings.REQUEST_MEDIA_ROUTING_CONTROL"ActivityAction.REQUEST_SCHEDULE_EXACT_ALARM = "android.settings.REQUEST_SCHEDULE_EXACT_ALARM"ActivityAction.REQUEST_SET_AUTOFILL_SERVICE = "android.settings.REQUEST_SET_AUTOFILL_SERVICE"ActivityAction.SCREEN_TIMEOUT_SETTINGS = "android.settings.SCREEN_TIMEOUT_SETTINGS"ActivityAction.SETTINGS_EMBED_DEEP_LINK_ACTIVITY = "android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY"ActivityAction.SHOW_ADMIN_SUPPORT_DETAILS = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS"ActivityAction.SHOW_REMOTE_BUGREPORT_DIALOG = "android.settings.SHOW_REMOTE_BUGREPORT_DIALOG"ActivityAction.SHOW_RESTRICTED_SETTING_DIALOG = "android.settings.SHOW_RESTRICTED_SETTING_DIALOG"ActivityAction.SIM_PREFERENCE_SETTINGS = "android.settings.SIM_PREFERENCE_SETTINGS"ActivityAction.STORAGE_MANAGER_SETTINGS = "android.settings.STORAGE_MANAGER_SETTINGS"ActivityAction.TEMPERATURE_UNIT_SETTINGS = "android.settings.TEMPERATURE_UNIT_SETTINGS"ActivityAction.TETHER_PROVISIONING_UI = "android.settings.TETHER_PROVISIONING_UI"ActivityAction.TETHER_UNSUPPORTED_CARRIER_UI = "android.settings.TETHER_UNSUPPORTED_CARRIER_UI"ActivityAction.TEXT_READING_SETTINGS = "android.settings.TEXT_READING_SETTINGS"ActivityAction.TURN_SCREEN_ON_SETTINGS = "android.settings.TURN_SCREEN_ON_SETTINGS"ActivityAction.USAGE_ACCESS_SETTINGS = "android.settings.USAGE_ACCESS_SETTINGS"ActivityAction.USER_DICTIONARY_INSERT = "android.settings.USER_DICTIONARY_INSERT"ActivityAction.USER_DICTIONARY_SETTINGS = "android.settings.USER_DICTIONARY_SETTINGS"ActivityAction.VIEW_ADVANCED_POWER_USAGE_DETAIL = "android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL"ActivityAction.VOICE_CONTROL_AIRPLANE_MODE = "android.settings.VOICE_CONTROL_AIRPLANE_MODE"ActivityAction.VOICE_CONTROL_BATTERY_SAVER_MODE = "android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE"ActivityAction.VOICE_CONTROL_DO_NOT_DISTURB_MODE = "android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE"ActivityAction.WIFI_CALLING_SETTINGS = "android.settings.WIFI_CALLING_SETTINGS"ActivityAction.WIFI_DETAILS_SETTINGS = "android.settings.WIFI_DETAILS_SETTINGS"ActivityAction.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR = "android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR"ActivityAction.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR = "android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR"ActivityAction.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER = "android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER"ActivityAction.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER = "android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER"ActivityAction.WIFI_SAVED_NETWORK_SETTINGS = "android.settings.WIFI_SAVED_NETWORK_SETTINGS"ActivityAction.WIFI_SCANNING_SETTINGS = "android.settings.WIFI_SCANNING_SETTINGS"ActivityAction.ZEN_MODE_AUTOMATION_SETTINGS = "android.settings.ZEN_MODE_AUTOMATION_SETTINGS"ActivityAction.ZEN_MODE_EVENT_RULE_SETTINGS = "android.settings.ZEN_MODE_EVENT_RULE_SETTINGS"ActivityAction.ZEN_MODE_PRIORITY_SETTINGS = "android.settings.ZEN_MODE_PRIORITY_SETTINGS"ActivityAction.ZEN_MODE_SCHEDULE_RULE_SETTINGS = "android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS"ActivityAction.ACCESSIBILITY_COLOR_SPACE_SETTINGS = "com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS"ActivityAction.OPEN_PRIVATE_SPACE_SETTINGS = "com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS"ActivityAction.SUGGESTION_STATE_PROVIDER = "com.android.settings.action.SUGGESTION_STATE_PROVIDER"ActivityAction.ADVANCED_CONNECTED_DEVICE_SETTINGS = "com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS"ActivityAction.APP_STORAGE_SETTINGS = "com.android.settings.APP_STORAGE_SETTINGS"ActivityAction.BATTERY_SAVER_SCHEDULE_SETTINGS = "com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS"ActivityAction.BATTERY_POWER_USAGE_ADVANCED = "com.android.settings.battery.action.POWER_USAGE_ADVANCED"ActivityAction.BIOMETRIC_SETTINGS_PROVIDER = "com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER"ActivityAction.BLUETOOTH_AUDIO_SHARING_SETTINGS = "com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS"ActivityAction.BLUETOOTH_DEVICE_DETAIL_SETTINGS = "com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS"ActivityAction.BUTTON_NAVIGATION_SETTINGS = "com.android.settings.BUTTON_NAVIGATION_SETTINGS"ActivityAction.GESTURE_NAVIGATION_SETTINGS = "com.android.settings.GESTURE_NAVIGATION_SETTINGS"ActivityAction.MONITORING_CERT_INFO = "com.android.settings.MONITORING_CERT_INFO"ActivityAction.MORE_SECURITY_PRIVACY_SETTINGS = "com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS"ActivityAction.NAVIGATION_MODE_SETTINGS = "com.android.settings.NAVIGATION_MODE_SETTINGS"ActivityAction.PREVIOUSLY_CONNECTED_DEVICE = "com.android.settings.PREVIOUSLY_CONNECTED_DEVICE"ActivityAction.SEARCH_RESULT_TRAMPOLINE = "com.android.settings.SEARCH_RESULT_TRAMPOLINE"ActivityAction.SECURITY_ADVANCED_SETTINGS = "com.android.settings.security.SECURITY_ADVANCED_SETTINGS"ActivityAction.SIM_SUB_INFO_SETTINGS = "com.android.settings.sim.SIM_SUB_INFO_SETTINGS"ActivityAction.STYLUS_USI_DETAILS_SETTINGS = "com.android.settings.STYLUS_USI_DETAILS_SETTINGS"ActivityAction.TRUSTED_CREDENTIALS_USER = "com.android.settings.TRUSTED_CREDENTIALS_USER"ActivityAction.WIFI_TETHER_SETTINGS = "com.android.settings.WIFI_TETHER_SETTINGS"ResultCode.Canceled = 0Means that the activity was canceled, for example, by tapping on the back button.