Our documentation is changing, please click here to enjoy it!

Skip to end of metadata
Go to start of metadata

Getting Started

Accengage SDK allows you to track the execution and display of In-App and to handle Push notifications of your application.

This Phonegap/Cordova documentation explains the various methods available and how to use them.

In order to understand more deeply the features of the SDK, please refer also to the User Guide, as well as native iOS and Android documentations.


Current Plugin Version: 1.1.0 (February 2016)

  • Android SDK Version: 3.3.+ 
    including Google Play Services 8.1.0 (Base, Location, GCM, Ads), A4SSDK-Beacons (1.0.2) and A4SSDK-GooglePlayServices (1.6.+)
  • iOS SDK Version: 5.4.0
  • Cordova version required : 5+

Plugin installation:

Link : http://cordova.apache.org/plugins/?q=com.bma4s.sdk.plugins.cordova




Basic Integration

Update the file config/BMA4SCordovaConfig.json with your PartnerID and you privateKey BEFORE preparing/building your app on Cordova.

BMA4SCordovaConfig example:

Please DO NOT copy paste the content of this example (comments are not allowed inside a valid JSON file) Fields with * means REQUIRED


Then call cordova prepare or/and cordova build

Some functions requires a function as a callback.

In this doc, this function is always named "theCallback" and can be any JS function.

This callback function always takes only one parameter which can be : the result OR an error.

If an error occurs, you will always get a JSONObject like this one : {"error":"The message of the error"}



You can have a list of all available SDK methods by looking at the following file : your-cordova-app/plugins/com.bma4s.sdk.plugins.cordova/example/example.html

If you want to use this file, please copy the content into your-cordova-app/www/index.html and do not forget to copy our stylesheet too (example/css/example.css).


If you still need more information (about methods compatibilities for instance), you can look our JS code at : your-cordova-app/plugins/com.bma4s.sdk.plugins.cordova/www/BMA4S.js

Advanced Integration

Please see platform related (iOS,Android) documentation for more information (methods usage, advanced integration..)

Push Notifications

Enable Pushs Notifications


To enable pushs notifications for iOS, edit your config/BMA4SCordovaConfig.json file with the following line:

Please see iOS Documentation for more informations.


Add your own sender Id to the config/BMA4SCordovaConfig.json file:

Please see Android Documentation for more informations.

Prevent RichPush notifications display

You can prevent the display of any RichPush notification, by calling: 

To reenable the RichPush Notifications, you can call:

You can enable/disable RichPush notifications at any time.

If you need to know the Rich Push lock status:

This lock does not affect In-App notifications.



If you want to track a specific event you can add to your code:

Where 1000 is your eventID and “test” is an argument of this event. Please note that you can add multiple arguments.

Using Analytics

You can track specific events like “Add to Cart”, “Purchase” and “Lead”. Here is how to use each of these events.


If you want to send a Lead, you can add to your code:

Add to Cart

If you want to track an Add to Cart event, add to your code:

Note: Currency should be a valid 3 letters ISO4217 currency (EUR,USD,..) and the 2 last arguments are price and quantity.


If you want to track a Purchase event, you can add to your code:

Note: Currency should be a valid 3 letters ISO4217 currency (EUR,USD,..) and the last argument is the total price of this purchase.

Update Device Information

You can create a device profile for each device in order to qualify the profile (for example, registering whether the user is opt in for or out of some categories of notifications). A device profile is a set of key/value that are uploaded to Accengage server. In order to update information about a device profile, add the following lines to your code:

Replace “key” and “value” with the segmentation key name and the value you want to set.

The keys and values must match Accengage user information field names and values to allow information to be correctly updated.

Date Format

You can send a date using the updateDeviceInfo method.

Your date has to be in the following format: “yyyy-MM-dd HH:mm:ss zzz”

Manually Update Geolocation (Android only)

Geolocation is automatically updated and sent to our servers if "android_no_geoloc" is false inside BMA4SCordovaConfig.json

If you want to manually update the current location of the device, you can call:


If you want to tag each Fragment/Tabs/Activity and be able to target it, you can use the following code as soon as a view is displayed:

Where your-view is the name of your view.

States (Android only)

In Accengage Interface, you can “Declare a State” (Applications → Advanced Parameters). States are like browser cookies which can be used to trigger Accengage In-App notifications. You can target one or more states and combine them with Event or ViewTag.

Example: When event 5000 is triggered and state “search” contains “pizz*”, display a specific In-App.

The following section explains how to declare certain states with the Accengage SDK.

Put a State

You can obtain the name of the state from the Accengage “value” field in Applications → Advanced Parameters → States section.

In order to put a state, write this code:

Where "search" is the state name and “myValue” is the value you want to put for this state.

Static Lists

First of all, to use a Static List, you need to create it on the Accengage User Interface.

Add the current device to a Static List

In order to add the current device to a Static List you have to provide a JSONArray containing JSONObjects including each a listId and an optional expireAt expiration date

Remove the current device from a Static List

In order to remove the current device to a Static List you have to provide a JSONArray containing JSONObjects including each a listId

Get subscription status

You have 2 ways to get the subscription status of the current device.

Get subscription status of selected lists

Retrieve the status of all wanted lists, you will need to pass a function in order to retrieve the result (here it's theCallback) :

Get all subscriptions of the current device

Retrieve the status of all lists, you will need to pass a function in order to retrieve the result (here it's theCallback) :


As a result, you will get a JSONArray containing some JSONObjects :

Tracking Facebook

Add your Facebook AppID in config/BMA4SCordovaConfig.json:

This will enable Facebook Tracking inside your app, no other step is needed on your behalf.

Deep Linking

Retrieve custom parameters from Push/In-App/Geofence/Beacons

If you want to retrieve custom parameters from Push, In-App or Inbox features, call:

Each time an Push/In-App is displayed or clicked, you will receive a response like this one:

Here, it's a push which has just been clicked.


action can contains:

categories can contains:

Only our Android SDK is broadcasting BEACON_NOTIFICATIONS and GEOFENCE_NOTIFICATIONS information to third party developer.

All parameters including your custom parameters are inside params (here we have a custom param named 'my-key')


For a Geofence/Beacon, you will receive a response like this one :

Here, we have entered 2 geofences.

transition :

  • 1 for enter
  • 0 for exit


For a beacon, the key will be



 instead of


More details can be found on Android#RetrievingBeaconinformationwithaBroadcastReceiver

Stop listening for custom parameters

If you don't want to retrieve custom parameters anymore, please call:

In-App Notifications

Prevent In-App notification display

If you don't want to display any inapp message temporarily, you can use:

This function allows you to enable or disable any In-App notification display. By default, its value is false which means that InApp display is enabled.

Once Inapp is locked, no In-App visual element will be displayed until unlocked. Please use this function with care!


Inbox is not yet available in our Cordova Plugin and must be implemented the native way

For iOS, please see iOS Documentation

For Android, please see Android Documentation.


Find your A4SID (or Device ID or Mobinaute ID)

If you need to get the Accengage Device ID (or "Mobinaute Id") of the user, use the following method:

Restrict SDK connection

You can temporarily restrict the connections in order to tell our SDK to stop flushing network requests.

All requests will be locked until you use setRestrictedConnection(false). In order to know if the connection is restricted for our SDK, please use:

Specific for Android

Activate Logs

To enable logs in the console, you can modify the following value of BMA4SCordovaConfig.json :

You will have to rebuild your app in order to see the logs


Please see the Android Troubleshooting and Android Optional Code.

Specific for iOS

Activate Logs

To enable logs in the console, you can use the method:


Please see the iOS Troubleshooting.


  • No labels