@elastosfoundation/elastos-cordova-plugin-intent
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

title: IntentManager description: This is an plugin for Elastos Cordova in order to manage external inter-app communications through "intents".

@elastosfoundation/elastos-cordova-plugin-intent

This plugin defines a global cordova.intentManager object, which provides an API for intent manager library.

Although in the global scope, it is not available until after the deviceready event.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    console.log(intentManager);
}

Usage

In typescript file

declare let intentManager: IntentPlugin.IntentManager;

Installation

    cordova plugin add @elastosfoundation/elastos-cordova-plugin-intent

Cofigure

tsconfig.app.json

    "types": [
        "@elastosfoundation/elastos-cordova-plugin-intent"
        ]

config.xml

  • Specific IntentRedirecturlFilter, with custom scheme for android vs https url for ios. such as
    <platform name="android">
        <preference name="IntentRedirecturlFilter" value="XXX://" />
        <config-file parent="/manifest/application/activity" target="AndroidManifest.xml">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="XXX" />
            </intent-filter>
        </config-file>
    </platform>

    <platform name="ios">
        <preference name="IntentRedirecturlFilter" value="https://XXX.sample.net" />
        <config-file parent="com.apple.developer.associated-domains" target="*-Debug.plist">
            <array>
                <string>applinks:XXX.sample.net</string>
            </array>
        </config-file>
        <config-file parent="com.apple.developer.associated-domains" target="*-Release.plist">
            <array>
                <string>applinks:XXX.sample.net</string>
            </array>
        </config-file>
    </platform>
    <platform name="android">
        <preference name="AndroidLaunchMode" value="singleTask" />
    </platform>

Supported Platforms

  • Android
  • iOS

Classes

IntentManager

Typedefs

ReceivedIntent : Object

Information about an intent request.

IntentManager

Kind: global class

appManager.sendIntent(action, params, onSuccess, [onError])

Send a intent by action.

Kind: instance method of IntentManager

Param Type Description
action string The intent action.
params Object The intent params.

appManager.addIntentListener(callback: (msg: ReceivedIntent)=>void)

Set intent listener for message callback.

Kind: instance method of IntentManager

Param Type Description
callback (msg: ReceivedIntent)=>void The function receive the intent.

appManager.sendIntentResponse(action, result, intentId, onSuccess, [onError])

Send a intent respone by id.

Kind: instance method of IntentManager

Param Type Description
action string The intent action.
result Object The intent respone result.
intentId long The intent id.

ReceivedIntent : Object

Information about an intent request.

Kind: IntentPlugin typedef Properties

Name Type Description
action string The action requested from the receiving application.
params any Custom intent parameters provided by the calling application.
intentId number The intent id of the calling application.
originalJwtRequest? string In case the intent comes from outside essentials and was received as a JWT, this JWT is provided here.

/@elastosfoundation/elastos-cordova-plugin-intent/

    Package Sidebar

    Install

    npm i @elastosfoundation/elastos-cordova-plugin-intent

    Weekly Downloads

    1

    Version

    2.0.2

    License

    MIT

    Unpacked Size

    107 kB

    Total Files

    16

    Last publish

    Collaborators

    • elastos-it
    • benjaminpiette
    • raozhiming