public class IntentModule extends NativeLinkingSpec
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 |
addListener(java.lang.String eventName) |
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 |
removeListeners(double count) |
void |
sendIntent(java.lang.String action,
ReadableArray extras,
Promise promise)
Allows to send intents on Android
|
getCurrentActivity, getReactApplicationContext, getReactApplicationContextIfActiveOrWarn
canOverrideExistingModule, getConstants, hasConstants, initialize, invalidate, onCatalystInstanceDestroy
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
invalidate
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)
getInitialURL
in class NativeLinkingSpec
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.
openURL
in class NativeLinkingSpec
url
- the URL to openpublic void canOpenURL(java.lang.String url, Promise promise)
canOpenURL
in class NativeLinkingSpec
url
- the URL to openpromise
- a promise that is always resolved with a boolean argumentpublic void openSettings(Promise promise)
openSettings
in class NativeLinkingSpec
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 } ]
sendIntent
in class NativeLinkingSpec
action
- The general action to be performedextras
- An array of extras [{ String, String | Number | Boolean }]public void addListener(java.lang.String eventName)
addListener
in class NativeLinkingSpec
public void removeListeners(double count)
removeListeners
in class NativeLinkingSpec