title | description |
---|---|
IntentManager |
This is an internal plugin for Elastos Essentials in order to manage internal and external inter-app communications through "intents". |
This plugin defines a global cordova.essentialsIntentManager
object, which provides an API for essentials 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(essentialsIntentManager);
}
declare let essentialsIntentManager: EssentialsIntentPlugin.IntentManager;
cordova plugin add elastos-essentials-plugin-intent
"types": [
"elastos-essentials-plugin-intent"
]
- Add InternalIntentFilters, RawUrlIntentFilters and IntentRedirecturlFilter.
<preference name="InternalIntentFilters" value="https://did.elastos.net https://wallet.elastos.net https://hive.elastos.net https://contact.elastos.net https://scanner.elastos.net" />
<preference name="IntentRedirecturlFilter" value="https://essentials.elastos.net" />
<preference name="RawUrlIntentFilters" value="wc: https://wallet.elastos.net/wc:" />
<platform name="android">
<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:host="essentials.elastos.net" android:pathPattern="/.*" android:scheme="https" />
</intent-filter>
<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:host="did.elastos.net" android:pathPattern="/.*" android:scheme="https" />
</intent-filter>
<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:host="wallet.elastos.net" android:pathPattern="/.*" android:scheme="https" />
</intent-filter>
<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:host="hive.elastos.net" android:pathPattern="/.*" android:scheme="https" />
</intent-filter>
<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:host="contact.elastos.net" android:pathPattern="/.*" android:scheme="https" />
</intent-filter>
<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:host="scanner.elastos.net" android:pathPattern="/.*" android:scheme="https" />
</intent-filter>
</config-file>
</platform>
<platform name="ios">
<preference name="SwiftVersion" value="5.2" />
<preference name="UseSwiftLanguageVersion" value="5.2" />
<config-file parent="com.apple.developer.associated-domains" target="*-Debug.plist">
<array>
<string>applinks:essentials.elastos.net</string>
<string>applinks:launcher.elastos.net</string>
<string>applinks:did.elastos.net</string>
<string>applinks:wallet.elastos.net</string>
<string>applinks:hive.elastos.net</string>
<string>applinks:contact.elastos.net</string>
<string>applinks:scanner.elastos.net</string>
</array>
</config-file>
<config-file parent="com.apple.developer.associated-domains" target="*-Release.plist">
<array>
<string>applinks:essentials.elastos.net</string>
<string>applinks:launcher.elastos.net</string>
<string>applinks:did.elastos.net</string>
<string>applinks:wallet.elastos.net</string>
<string>applinks:hive.elastos.net</string>
<string>applinks:contact.elastos.net</string>
<string>applinks:scanner.elastos.net</string>
</array>
</config-file>
</platform>
- In android platform
<platform name="android">
<preference name="AndroidLaunchMode" value="singleTask" />
</platform>
- Android
- iOS
- ReceivedIntent :
Object
Information about an intent request.
- IntentSource :
enum
Information about an intent from.
Kind: global class
Send an intent by action.
Kind: instance method of IntentManager
Param | Type | Description |
---|---|---|
action | string |
The intent action. |
params | Object |
The intent params. |
Set intent listener for message callback.
Kind: instance method of IntentManager
Param | Type | Description |
---|---|---|
callback | (msg: ReceivedIntent)=>void |
The function receive the intent. |
Send an 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. |
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. |
from | IntentSource |
From 'internal' or 'external'.. |
Information about an intent request.
Kind: IntentPlugin enum Properties
Name | Value | Description |
---|---|---|
Internal | "INTERNAL" | The intent from internal. |
External | "EXTERNAL" | The intent from external. |