Package 

Class IntentModule

  • All Implemented Interfaces:
    com.facebook.react.bridge.NativeModule , com.facebook.react.bridge.ReactModuleWithSpec , com.facebook.react.turbomodule.core.interfaces.TurboModule

    
    public class IntentModule
    extends NativeIntentAndroidSpec
                        

    Intent module. Launch other activities or open URLs.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static String NAME
    • Method Summary

      Modifier and Type Method Description
      String getName()
      void getInitialURL(Promise promise) Return the URL the activity was started with
      void openURL(String url, Promise promise) Starts a corresponding external activity for the given URL.
      void canOpenURL(String url, Promise promise) Determine whether or not an installed app can handle a given URL.
      void openSettings(Promise promise) Starts an external activity to open app's settings into Android Settings
      void sendIntent(String action, @Nullable() ReadableArray extras, Promise promise) Allows to send intents on AndroidFor example, you can open the Notification Category screen for a specific applicationpassing 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.
      • Methods inherited from class com.facebook.fbreact.specs.NativeIntentAndroidSpec

        sendIntent
      • Methods inherited from class com.facebook.react.bridge.BaseJavaModule

        canOverrideExistingModule, getConstants, hasConstants, initialize, invalidate, onCatalystInstanceDestroy
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInitialURL

         void getInitialURL(Promise promise)

        Return the URL the activity was started with

        Parameters:
        promise - a promise which is resolved with the initial URL
      • openURL

         void openURL(String url, Promise promise)

        Starts a corresponding external activity for the given URL.

        For example, if the URL is "https://www.facebook.com", the system browser will be opened, orthe "choose application" dialog will be shown.

        Parameters:
        url - the URL to open
      • canOpenURL

         void canOpenURL(String url, Promise promise)

        Determine whether or not an installed app can handle a given URL.

        Parameters:
        url - the URL to open
        promise - a promise that is always resolved with a boolean argument
      • openSettings

         void openSettings(Promise promise)

        Starts an external activity to open app's settings into Android Settings

        Parameters:
        promise - a promise which is resolved when the Settings is opened
      • sendIntent

         void sendIntent(String action, @Nullable() ReadableArray extras, Promise promise)

        Allows to send intents on Android

        For example, you can open the Notification Category screen for a specific applicationpassing 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 } ]

        Parameters:
        action - The general action to be performed
        extras - An array of extras [{ String, String | Number | Boolean }]