public class IntentModule extends ReactContextBaseJavaModule
NativeModule.NativeMethod
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
METHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC
Constructor and Description |
---|
IntentModule(ReactApplicationContext reactContext) |
Modifier and Type | Method and Description |
---|---|
void |
canOpenURL(java.lang.String url,
Promise promise)
Determine whether or not an installed app can handle a given URL.
|
void |
getInitialURL(Promise promise)
Return the URL the activity was started with
|
java.lang.String |
getName() |
void |
openSettings(Promise promise)
Starts an external activity to open app's settings into Android Settings
|
void |
openURL(java.lang.String url,
Promise promise)
Starts a corresponding external activity for the given URL.
|
void |
sendIntent(java.lang.String action,
ReadableArray extras,
Promise promise)
Allows to send intents on Android
|
getCurrentActivity, getReactApplicationContext
canOverrideExistingModule, getConstants, hasConstants, initialize, invalidate, onCatalystInstanceDestroy
public static final java.lang.String NAME
public IntentModule(ReactApplicationContext reactContext)
public java.lang.String getName()
require()
this module
from javascript.public void getInitialURL(Promise promise)
promise
- a promise which is resolved with the initial URLpublic void openURL(java.lang.String url, Promise promise)
For example, if the URL is "https://www.facebook.com", the system browser will be opened, or the "choose application" dialog will be shown.
url
- the URL to openpublic void canOpenURL(java.lang.String url, Promise promise)
url
- the URL to openpromise
- a promise that is always resolved with a boolean argumentpublic void openSettings(Promise promise)
promise
- a promise which is resolved when the Settings is openedpublic void sendIntent(java.lang.String action, ReadableArray extras, Promise promise)
For example, you can open the Notification Category screen for a specific application passing action = 'android.settings.CHANNEL_NOTIFICATION_SETTINGS' and extras = [ { 'android.provider.extra.APP_PACKAGE': 'your.package.name.here' }, { 'android.provider.extra.CHANNEL_ID': 'your.channel.id.here } ]
action
- The general action to be performedextras
- An array of extras [{ String, String | Number | Boolean }]