If you have multiple apps, pass your app identifier as the optional last argument of init so that the app's sessions, user data, and push notification targeting are attributed to the correct app.
This parameter is available on Cordova SDK 4.1.0 or higher.
App identifier format
Your app identifier is provided by Insider One. It must follow these rules:
Only lowercase letters (a-z), digits (0-9), and underscores (_).
Must start with a lowercase letter or a digit.
At most 50 characters. Pattern: ^[a-z0-9][a-z0-9_]{0,49}$
Bundle-identifier style values such as com.acme.myapp are not valid.
An invalid app identifier does not block initialization. The SDK logs a warning, ignores the value, and initializes as if you passed no app identifier. In that case, the SDK attributes the app's data to the partner's default app.
The following table shows the data type for each method parameter.
Parameter | Data Type | Description |
|---|---|---|
partnerName | string | Your partner name provided by Insider One. |
appGroup | string | Your iOS App Group. Pass any value on Android. |
handleNotificationCallback | Function | The callback handler. |
appIdentifier | string | null (optional) | Your app identifier provided by Insider One. Must match ^[a-z0-9][a-z0-9_]{0,49}$. |
Method signature
init(
partnerName: string,
appGroup: string,
handleNotificationCallback: Function,
appIdentifier?: string | null
): void;Method example
document.addEventListener('deviceready', onDeviceReady, false);
function handleInsiderCallback(callback) {
switch (callback.action) {
case 'NOTIFICATION_OPEN':
// Handle push tap.
break;
}
}
async function onDeviceReady() {
await Insider.init(
'your_partner_name',
'group.com.your-company.your-app', // iOS App Group; pass any value on Android.
handleInsiderCallback,
'your_app_identifier'
);
}Initialization behavior
If you omit the argument, or pass null, '', or any non-string value, the SDK initializes exactly as before.
The plugin passes the value to the native SDKs, which validate it. The SDK logs an invalid value and ignores it, and initialization still completes.
Calling reinitWithPartnerName with a different partner name clears the app identifier on both platforms. Calling it with the current partner name keeps the app identifier.