Expo

Documentation

IntentLauncher

Provides a way to launch android intents. e.g. - opening a specific settings screen.

For managed apps, you'll need to run expo install expo-intent-launcher. To use it in a bare React Native app, follow its installation instructions.
Note: Not compatible with web.

import * as IntentLauncher from 'expo-intent-launcher';

Starts the specified activity. The method will return a promise which resolves when the user returns to the app.

  • activityAction (string) -- The action to be performed, e.g. IntentLauncher.ACTION_WIRELESS_SETTINGS. There are a few pre-defined constants you can use for this parameter. You can find them at expo-intent-launcher/src/IntentLauncher.ts. Required
  • intentParams (IntentParams) -- An object of intent parameters.

A promise resolving to an object of type IntentResult.

KeyTypeDescription
typestringA 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.
categorystringCategory provides more details about the action the intent performs. See Intent.addCategory.
extraobjectA map specifying additional key-value pairs which are passed with the intent as extras. The keys must include a package prefix, for example the app com.android.contacts would use names like com.android.contacts.ShowAll.
datastringA URI specifying the data that the intent should operate upon. (Note: Android requires the URI scheme to be lowercase, unlike the formal RFC.)
flagsnumberBitmask of flags to be used. See Intent.setFlags for more details.
packageNamestringPackage name used as an identifier of ComponentName. Set this only if you want to explicitly set the component to handle the intent.
classNamestringClass name of the ComponentName.

KeyTypeDescription
resultCodenumberResult code returned by the activity. See ResultCode for more details.
datastringOptional data URI that can be returned by the activity.
extraobjectOptional extras object that can be returned by the activity.

Result codeValueDescription
Success-1Indicates that the activity operation succeeded.
Canceled0Means that the activity was canceled, e.g. by tapping on the back button.
FirstUser1First custom, user-defined value that can be returned by the activity.

import * as IntentLauncher from 'expo-intent-launcher';

// Open location settings
IntentLauncher.startActivityAsync(IntentLauncher.ACTION_LOCATION_SOURCE_SETTINGS);