OpenBack Cordova Plugin
In your project root folder, add the OpenBack plugin with:
The plugin sources and sample code are available on Github here.
Edit your application
config.xml with the following preferences:
Set your application code for each platform:
iOS Specific Configurations
All the values are optional except for the application code.
|appCode||The application code (Required)|
|enableAlertNotifications||Enable alert notifications (Optional - Default: true)|
|enableRemoteNotifications||Enable remote notifications (Optional - Default: true)|
|enableProximity||Enable proximity sensor (Optional - Default: false)|
|enableMicrophone||Enable microphone (Optional - Default: false)|
|enableMotionCoprocessor||Enable motion coprocessor (Optional - Default: false)|
|enableLocation||Enable location (Optional - Default: false)|
|requestLocationAlwaysAuthorization||Allows OpenBack to prompt for location always authorization (Optional - Default: true)|
|requestAlertNotificationsAuthorization||Allows OpenBack to prompt for system alert notifications authorization (Optional - Default: true)|
|requestMotionCoprocessorAuthorization||Allows OpenBack to prompt for motion coprocessor access authorization (Optional - Default: true)|
|requestMicrophoneAuthorization||Allows OpenBack to prompt for microphone authorization (Optional - Default: true)|
|minimumFetchInterval||Set the minimim fetch interval in seconds (Optional - Default: 0). Use -1 for UIApplicationBackgroundFetchIntervalNever. Use 0 for UIApplicationBackgroundFetchIntervalMinimum|
|notificationSound||Set the notification sound (Optional - Default: UILocalNotificationDefaultSoundName)|
|logLevel||The debug log level (Opetional - Default: 0 - Up to 5 for verbose)|
APNs for Push Notifications
Follow the information from the iOS Integration Guide.
Android Specific Configurations
OpenBack for android requires a minimum SDK of 16.
This file is used by the OpenBack SDK to set the notification icon for android 5+. Make sure the icon is copied to your android platform. You can customize the light, vibration pattern and sound too. For more info, check Android Integration guide.
appCode should also be set in this file. It is used by the SDK to setup itself during an application upgrade.
When building for android, make sure the
openback.json file is in the assets folder. If not, you might need to try with:
Firebase is also required for some features (instant message update, regular push messages). We recommend using https://www.npmjs.com/package/cordova-plugin-firebase.
Refer to the Android Integration guide to setup the manifest depending on the triggers the application will use. Include the extra permissions and receiver actions in the
config.xml file of your application.
failure parameters are callback functions.
If your application needs COPPA to be enabled, set the COPPA compliant status with this function. If COPPA is enabled, messages will not run unless compliant is set to true.
When your user requests that all the data should be erased, set this value to true. It will inform the OpenBack server to remove all logs for the current user. All future logs will be erased after processing. If you wish to be fully GDPR complient, you also need to enable GDPR in your application settings on the OpenBack Dashboard.
Logging a Goal
At any point, you can log a goal that is associated with a message. Make sure to use the Goal code, not the Goal name.
User Info & Custom Values
Set a custom trigger value. Value can be
For the trigger index, use CUSTOM_TRIGGER_1 to CUSTOM_TRIGGER_10.
The application can pass some extra user information using a simple dictionary object by setting the following fields:
|string||Address line 1|
|string||Address line 2|
|string||Advertising identifier set by the application|
|string||ISO-2 country code|
|string||Date of birth YYYY-MM-DD|
|string||Opting in for message updates "true"/"false"|
|string||Phone Number (international format)|
|string||Custom user identifier 1|
|string||Custom user identifier 2|
|string||Custom user identifier 3|
|string||Custom user identifier 4|
|string||Custom user identifier 5|
Note on Custom User Identifiers
Identity is for use with the OpenBack API. If you are not an OpenBack API client, don't use them. Identities are bound to the current OpenBack user, so changing any one of them will reset user and campaign usage. A usage example: when your application has users that can login and logout, you can set one of the Identity to a token used in your system to identify that user. Later on, using the OpenBack API, you can fetch details from that user.
Returns the current OpenBack SDK version.