Skip to content

Advanced Setup

User Info

Use the User Info object to customize the delivery moment and content of a message.

Standard

User Info - Standard can be used to personalise content within messages.

Class container for the user info.

Name Type Description
AddressLine1 String Address line 1
AddressLine2 String Address line 2
AdvertisingId String Advertising identifier set by the application
Age String Age
Country String Country
CountryCode String ISO-2 country code
State String State
DateOfBirth String Date of birth YYYY-MM-DD
FirstName String First name
Gender String Gender
OptInUpdates String Opting in for campaign updates "true"/"false"
PostCode String Postal code
Profession String Profession
Surname String Surname
Title String Title
City String City

Custom

User Info - Custom triggers are set by your mobile app and used to trigger a message when the value set by the mobile app matches the value set in the message through the OpenBack Dashboard or Client API. The values set can also be used as personalised content within messages.

Constants

public final static int CUSTOM_TRIGGER_1
public final static int CUSTOM_TRIGGER_2
public final static int CUSTOM_TRIGGER_3
public final static int CUSTOM_TRIGGER_4
public final static int CUSTOM_TRIGGER_5
public final static int CUSTOM_TRIGGER_6
public final static int CUSTOM_TRIGGER_7
public final static int CUSTOM_TRIGGER_8
public final static int CUSTOM_TRIGGER_9
public final static int CUSTOM_TRIGGER_10

setCustomTrigger

public static void setCustomTrigger(Context context, int triggerIndex, String value)
public static void setCustomTrigger(Context context, int triggerIndex, int value)
public static void setCustomTrigger(Context context, int triggerIndex, float value)

Set a custom trigger value. Value can be String, int or float.
For the trigger index, see Custom Triggers list.

Example:

OpenBack.setCustomTrigger(getApplicationContext(), OpenBack.CUSTOM_TRIGGER_1, "StringTest");
OpenBack.setCustomTrigger(getApplicationContext(), OpenBack.CUSTOM_TRIGGER_2, 42);
OpenBack.setCustomTrigger(getApplicationContext(), OpenBack.CUSTOM_TRIGGER_3, 1.12);
OpenBack.setCustomTrigger(applicationContext, OpenBack.CUSTOM_TRIGGER_1, "StringTest")
OpenBack.setCustomTrigger(applicationContext, OpenBack.CUSTOM_TRIGGER_2, 42)
OpenBack.setCustomTrigger(applicationContext, OpenBack.CUSTOM_TRIGGER_3, 1.12f)

Available since: 2.0.0

OpenBack typically supports up to 10 custom values, if you need more please discuss with OpenBack or email integrations@openback.com

Identities

The User Info - Identity is only used when you integrate the OpenBack Client API into your backend systems and want to message a user with that identity.

Name Type Description
Identity1 String Custom user identifier 1
Identity2 String Custom user identifier 2
Identity3 String Custom user identifier 3
Identity4 String Custom user identifier 4
Identity5 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.

Topics

The OpenBack SDK can be used to message users that are subscribed to certain topics. For more information on topics, contact integrations@openback.com

Events

The OpenBack SDK can be used to track events. An event is an action at a particular moment in time for each user, which is then used to target users and personalize content. For more information on events, contact integrations@openback.com

Goals

The OpenBack SDK can be used to track Goals. These can range from anything such as a user completing a signup process, to a user purchasing a product.

Every goal has six components:

  • Goal Code - This is a unique identifier for each goal.
  • Goal Name - A name to easily distinguish between each goal.
  • Goal Description - A short description of what the goal achieves.
  • Number of Steps - The number of steps required for the goal to be completed. For example, step 1 is a user viewing a product, step 2 is the user adding the product to their cart. Step 3 and goal completion is the user purchasing the product.
  • Conversion Window - The length of time after a notification is received that it can be attributed to a goal completion.
  • Default Goal Value - This sets how much the goal completion is worth.

You can find the steps to logging a goal in Android here.

Other Apps Trigger

The Other Apps trigger allows you to send notifications to users based on apps that they currently have installed. The Other Apps trigger for Android can be completely setup and controlled from the OpenBack dashboard. Head to your View Apps and select the app you would like to edit. Select the Other App Settings tab and choose to either search for your app or add it manually.

Manually Adding an Other App

To manually add an Other App, you must first get the package name for the app. If you don't know an app's package name, it can be found on the Google Playstore very easily.

Go to the Playstore page for the app you want and you can find the app package name in the URL after the id parameter. Just copy everything after id= in the URL.

Grabbing the Package Name

Once you have the app package name, head to the Other Apps settings tab of your app and fill out the details. Set the Other App Label field to the name of the app and then add your package name to the Other App Package Name field.

Setting Package Name

App Inbox

The OpenBack Android SDK supports an App Inbox feature which allows users to read messages even after they have dismissed the notification. Your application is in charge of managing and displaying the messages. For more information on implementing this feature in your app, go here.

Optional Permissions

We recommend that you add all normal permissions that you are comfortable with and only add user prompted permissions if necessary.

Normal Permissions

These permissions are accepted by a user when the app is installed.

Activity Permissions

<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />

Add the Google Play Services location dependency in your gradle file:

dependencies {
    implementation "com.google.android.gms:play-services-location:11.8.0"
}

Bluetooth Permissions

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />

Unlock Permissions

<receiver android:name="com.openback.OpenBackReceiver" android:exported="true">
    <intent-filter>
        ...
        <action android:name="android.intent.action.USER_PRESENT" />
        ...
    </intent-filter>
</receiver>

Aeroplane Permissions

<receiver android:name="com.openback.OpenBackReceiver" android:exported="true">
    <intent-filter>
        ...
        <action android:name="android.intent.action.AIRPLANE_MODE" />
        ...
    </intent-filter>
</receiver>

Connectivity Permissions

<receiver android:name="com.openback.OpenBackReceiver" android:exported="true">
    <intent-filter>
        ...
        <action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
        <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />          

        ...
    </intent-filter>
</receiver>

Battery Permissions

<receiver android:name="com.openback.OpenBackReceiver" android:exported="true">
    <intent-filter>
        ...
        <action android:name="android.intent.action.BATTERY_LOW" />
        <action android:name="android.intent.action.BATTERY_OKAY" />
        <action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
        <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
        ...
    </intent-filter>
</receiver>

User Prompted Permissions

Starting with Android 6.0, users have to explicitly grant some permissions during runtime, also known as dangerous permissions. Click here for more information.

Location Permissions

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 

<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false"/> 

Phone Permissions

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-feature android:name="android.hardware.telephony.gsm" android:required="false" />
<uses-feature android:name="android.hardware.telephony.cdma" android:required="false" />

<receiver android:name="com.openback.OpenBackReceiver" android:exported="true">
    <intent-filter> 
        ...
        <action android:name="android.intent.action.PHONE_STATE" />
        ...
    </intent-filter>
</receiver>

Noise Permissions

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.microphone" android:required="false" />

Handling onNewIntent

When using Smart Push campaigns with a simple message or a URL and the URL cannot be opened by the system, OpenBack brings your application to the foreground when the notification is selected. If the application was already in the foregound, that step is skipped. If your application was in the background, the library launches the last known Activity with singleTop flag. If your activity overrides onNewIntent, you can check if it was from the OpenBack library by using:

protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    if(intent.getBooleanExtra(OpenBack.OPENBACK_TO_FRONT_EXTRA, false)) {
        // OpenBack trying to bring your app in the foreground - maybe skip doing a major refresh
    }
}

Setting up ProGuard rules?

There is no need to set up ProGuard rules regarding the OpenBack SDK. These rules are set in the SDK and are included in your app upon building.

External Dependencies

Required dependencies:

implementation "com.google.code.gson:gson:2.8.5"
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:support-annotations:28.0.0"
implementation "com.android.support:support-compat:28.0.0"
implementation "com.android.support:support-media-compat:28.0.0"
implementation "com.android.support:support-v4:28.0.0"

Optional dependencies:

implementation "com.google.android.gms:play-services-location:16.0.0"
implementation "com.google.firebase:firebase-messaging:17.6.0"


On Android 8+, OpenBack uses JobScheduler with JOB_ID 2700 for the OpenBackService and 2701 for the OpenBackAssetService. If you are using the JobScheduler directly or from a 3rd party SDK, you might have some conflict when using the same JOB_ID. Let us know if it is the case.