wollfish-cordova-plugin-firebase-dynamiclinks
v6.1.3
Published
Cordova plugin for Firebase Dynamic Links
Downloads
3
Maintainers
Readme
Cordova plugin for Firebase Dynamic Links
Index
Supported Platforms
- iOS
- Android
Installation
$ cordova plugin add cordova-plugin-firebase-dynamiclinks --variable APP_DOMAIN_NAME="mydomain.page.link"
Use variable APP_DOMAIN_NAME
to specify your Google generated *.page.link
domain or other custom domain.
$ cordova plugin add cordova-plugin-firebase-dynamiclinks --variable APP_DOMAIN_NAME="mydomain.com" --variable APP_DOMAIN_PATH="/app1"
Use variables APP_DOMAIN_PATH
to speciy a specific domain path prefix when using a custom domain. This is useful if multiple apps share the same root level domain. If specified this path must begin with a /
.
Use variables IOS_FIREBASE_POD_VERSION
and ANDROID_FIREBASE_DYNAMICLINKS_VERSION
to override dependency versions for Firebase SDKs:
$ cordova plugin add cordova-plugin-firebase-dynamiclinks --variable IOS_FIREBASE_POD_VERSION="~> 8.8.0" --variable ANDROID_FIREBASE_DYNAMICLINKS_VERSION="20.1.+"
Adding required configuration files
Cordova supports resource-file
tag for easy copying resources files. Firebase SDK requires google-services.json
on Android and GoogleService-Info.plist
on iOS platforms.
- Put
google-services.json
and/orGoogleService-Info.plist
into the root directory of your Cordova project - Add new tag for Android platform
<platform name="android">
...
<resource-file src="google-services.json" target="app/google-services.json" />
</platform>
...
<platform name="ios">
...
<resource-file src="GoogleService-Info.plist" />
</platform>
Methods
getDynamicLink
Determines if the app has a pending dynamic link and provide access to the dynamic link parameters.
cordova.plugins.firebase.dynamiclinks.getDynamicLink().then(function(data) {
if (data) {
console.log("Read dynamic link data on app start:", data);
} else {
console.log("App wasn't started from a dynamic link");
}
});
onDynamicLink(callback)
Registers callback that is triggered on each dynamic link click.
cordova.plugins.firebase.dynamiclinks.onDynamicLink(function(data) {
console.log("Dynamic link click with data:", data);
});
Every create*
method accepts dynamicLinkInfo
object as the first argument. Read section below to understand all supported dynamic link parameters.
createDynamicLink(parameters)
Creates a Dynamic Link from the parameters. Returns a promise fulfilled with the new dynamic link url.
cordova.plugins.firebase.dynamiclinks.createDynamicLink({
link: "https://google.com"
}).then(function(url) {
console.log("Dynamic link was created:", url);
});
createShortDynamicLink(parameters)
Creates a shortened Dynamic Link from the parameters. Shorten the path to a string that is only as long as needed to be unique, with a minimum length of 4 characters. Use this method if sensitive information would not be exposed if a short Dynamic Link URL were guessed.
cordova.plugins.firebase.dynamiclinks.createShortDynamicLink({
link: "https://google.com"
}).then(function(url) {
console.log("Dynamic link was created:", url);
});
createUnguessableDynamicLink(parameters)
Creates a Dynamic Link from the parameters. Shorten the path to an unguessable string. Such strings are created by base62-encoding randomly generated 96-bit numbers, and consist of 17 alphanumeric characters. Use unguessable strings to prevent your Dynamic Links from being crawled, which can potentially expose sensitive information.
cordova.plugins.firebase.dynamiclinks.createUnguessableDynamicLink({
link: "https://google.com"
}).then(function(url) {
console.log("Dynamic link was created:", url);
});
Dynamic link parameters
Any create method supports all options below to customize a returned dynamic link. Parameter names has the same meaning as in the Firebase Dynamic Links Short Links API Reference:
{
"domainUriPrefix": string,
"link": string,
"androidInfo": {
"androidPackageName": string,
"androidFallbackLink": string,
"androidMinPackageVersionCode": number
},
"iosInfo": {
"iosBundleId": string,
"iosFallbackLink": string,
"iosIpadFallbackLink": string,
"iosIpadBundleId": string,
"iosAppStoreId": string
},
"navigationInfo": {
"enableForcedRedirect": boolean,
},
"analyticsInfo": {
"googlePlayAnalytics": {
"utmSource": string,
"utmMedium": string,
"utmCampaign": string,
"utmTerm": string,
"utmContent": string
},
"itunesConnectAnalytics": {
"at": string,
"ct": string,
"pt": string
}
},
"socialMetaTagInfo": {
"socialTitle": string,
"socialDescription": string,
"socialImageLink": string
}
}