The OpenBack Unity plugin supports Android & iOS. It is setup to use the Google Unity play service resolver to import the SDKs for both android and iOS. The Google resolver provides a simple way to get the OpenBack SDKs from our maven repository and Cocoapods.
The OpenBack dependencies are listed in OpenBackDependencies.xml. If you need to change versions, feel free to udpate this file.
The plugin and bootstrap source code are available here.
Import OpenBack Unity plugin
To import a package in Unity, use the menu Assets > Import Package > Custom Package....
Option 1: Download OpenBackWithResolver.unitypackage
If you are not already using the Google resolver, everything is provided in this package at the cost of size (~8MB).
If you already have the Google resolver with support for xml dependencies, or want to stay up to date with the latest release, use this option. The OpenBack package is small (~7K).
Option 3: Download only OpenBack.unitypackage
If you do not want to use Google resolver, use the OpenBack package only. You will need to manually download the latest OpenBack SDKs for Android and iOS. Place the aar in the Plugins/Android folder and the unzipped framework in the Plugins/iOS folder. For Android, you will need to add the dependencies manually. For iOS you will need to follow the Integration Guide to make sure the framework is stripped from simulator architectures and added to the embedded binaries.
Open and edit the provided StreamingAssets/openback.json file with your appCode.
You can also configure the material notification icon in this file for Android 5+. Please refer to the Android documentation for more info.
We recommend using the Gradle build system as manifest merging is done the right way.
We provide the package OpenBackBootstrap.unitypackage for single dex applications and OpenBackBootstrap-MultiDex.unitypackage for multi-dex applications to help bootstrap OpenBack on Android.
Openback is normally initialized during the
onCreate() call of your application class. This extra package is a simple aar that adds a manifest that sets the
android:name attribute of your application to use
com.openback.unity.UnityApplication. The code is available here.
If your application already uses a custom
Application class, call OpenBack like this:
Add the OpenBack Firebase service handlers in your Android manifest. See Setting Up Firebase for more details.
When using the resolver, uncomment the Firebase sections in the OpenBack dependencies OpenBack/Editor/OpenBackDependencies.xml then run the resolver again to import the required libraries. You need to copy the goole-services.json file you get from your Firebase console. See Setting Up Firebase for more details.
Starting with version 2.4.0, the location service is not a hard dependency. If you plan on using location triggers, uncomment the section in the OpenBack dependencies OpenBack/Editor/OpenBackDependencies.xml then run the resolver again.
Update OpenBack Configuration
UpdateInfoPList() is used to add extra values to the info.plist - this is where you want to add the URL schemes needed by the Other Apps trigger.
CreateOpenBackConfig() is usesd to generate the OpenBackConfig.plist file - this is where you set the AppCode and the features you want to use.
Check the general iOS Configuration Guide for more info on the features and expected values.
Enable Push Notification
Open the XCode workspace and enable psuh notification in the project capabilities. See the Setup APNs Certificates for Push Notifications for more info.
These endpoints are used for your app to interact directly with OpenBack.
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.
Returns the current OpenBack version. The version is platform specific.
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.
Set a custom trigger value. Value can be
For the trigger index, use CustomTrigger1 to CustomTrigger10,
Use this API to trigger an event. If a message matches your event and any other triggers, the message will be displayed after the given delay.
Delay is in seconds. If delay is a non-negative number, it will override the default value is set in the OpenBack Dashboard.
Use this API to cancel an event. Removes the displayed and scheduled notifications for the message set to use that event.
The application can pass some extra user information using the
OpenBackUserInfo struct 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|