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

Skip to end of metadata
Go to start of metadata

Getting Started

This React Native documentation explains various SDK methods available and how to use them.  
In order to understand more deeply the features of the SDK, please refer to the native iOS and Android documentation.

Accengage React-Native module 1.2.0 uses:

  • Android SDK version 3.8.6
  • iOS SDK version 6.4.3



Common requirements

  • React-native 0.49+ 

Android requirements

To integrate our React-Native plugin on Android, you will need the following :

iOS requirements

To integrate our React-Native plugin on iOS, you will need the following :

  • Xcode 8 or higher 
  • iOS 8 or higer

Common Integration

  1. Install our native module

  2. Link our native module

    Done ! Our module should be successfully linked to your iOS/Android project.

Don't forget to import the plugin in your .js files like this :

    • Add the following lines to android/settings.gradle :

    • Add the following lines to android/app/build.gradle :

    • Add these lines in android/app/src/main/java/your_package_name/MainApplication.java

    • And don't forget to add a few lines into your Activities methods defining the lifecycle of the activity
    Modifying Activity methods

    Since 1.1.0, you can manage GDPR compliancy

    There are two steps for sending user opt-in for data collection to Accengage.

    First, there is a parameter that you can override in order to let us know about user opt-in or opt-out for data collection. This parameter is acc_optin_data. In your string ressource file set it to true if you plan to send user opt-in to Accengage :


     If the parameter "acc_optin_data" is set to "false" or any other value different from "true", our SDK will automatically be launched without the need of calling the "setOptinData" method.

    If it is false, we consider that the user opt-in has been retrieved another way.


    • Once the module has been linked to the application, the framework must be linked to the application as well. 
      Go to the General tab of your app target in Xcode and add the framework in Embedded Binaries section. It is located in PROJECT_ROOT/node_modules/react-native-acc/ios/Frameworks.

    • Add $(PROJECT_DIR)/../node_modules/react-native-acc/ios/Frameworks path to Framework Search Paths (in target Build Settings).

    • To finalize the integration, please refer to the Getting Started chapter of the native SDK documentation.

    • Don't forget to add the config file AccengageConfig.plist and start the SDK natively in AppDelegate.m:


    Common methods

    Enable the Push Notifications

    To enable Push Notifications, you can use this method:

    You need to call this every time your app is launched.

    If at some point you want to disable the Push Notifications in Android :

    Lock the Push Notifications

    The SDK resumes the last activity or the main one (if the app is not launched) before handling an "attached" action. If for some reason after resuming the activity you don't want to display immediately an another one executing your attached action, you may use the SDK method:

    This method prevents the display of activities executing the attached actions. To enable the processing of the attached actions you need to call:

    Get the Push Token

    If you want to get the Push Token, you can use this method:

    Push observers

    You can be notified when the app receives a push or when a user clicks on it.


      Install GCM Plugin (Android)

      If you want to use GCM in your app, your must install the GCM plugin by running these commands :

      Then you should add the GCM module imports in your MainApplication.java :


      Please note that our plugin uses the version 11.4.2 of the Google Play Services. So you should be sure that ALL your modules have the same version to avoid conflicts.


      To enable push follow the android documentation to create your GCM Sender Id and set it in strings.xml like this :


      Provisional push notification (iOS 12)

      With iOS 12, developers have the ability to start sending notifications without explicit permission. Apple calls this new notification management protocol “provisional authorization”. Provisional authorization comes with quiet notifications.

      To enable the provisional push notification integration for iOS 12 you need to call:


      iOS 10 Rich Notifications

      The latest version of the plugin supports iOS 10 Rich Notifications. However, to be able to receive these notifications you'll need to add the corresponding extension and the AccengageExtension framework manually to your project. 

      Please see our iOS Media attachments Documentation for the required steps and more information on this topic.


      The Accengage SDK provides the notification display without any additional code required to enable them.

      It is possible to disable the display of InApp, for example if you are using splashscreen or if you have views in which you don't want them to appear using:

      In-App observers

      You can be notified when the app displays or closes an InAppNotification or when a user clicks on it.





        Custom Events

        Custom events are events which have an ID (integer) and a Value (ReadableMap in React)

        Each event needs to be defined in the Accengage User Interface. Go to Settings > Advanced Settings, and add a new event of type Custom with the code used in trackEvent method. The label is only used for a display purpose.

          Plugin version 1.1.1

          If you are using version 1.1.1 , we recommend you to update to 1.1.2+ in order to use trackEvent method. More informations in our Changelog

          Event API has been updated. You can now use the method ‘trackCustomEvent:withCustomParameters:’ for example :



          For iOS this method is deprecated from version 1.1.1

          We recommend you to use the method available in the tab "iOS New"


          Where 5001 is your event id, and value is your object.

          SDK 3.7.0+ :

          Please be aware that the maximum length allowed for a custom event is 1024 characters.

          SDK 3.6.5 and inferior versions :

          Please be aware that the maximum length allowed for a custom event is 255 characters.

          If you exceed the maximum length, the event value will be ignored.


          If you want to send a Lead to Accengage Servers:

          Add to Cart

          First, you will need to create an item to track, like this one:

          Now you just need to specify the cart id, the currency and the item:

          Currency should be a valid 3 letters ISO4217 currency (EUR,USD,..)


          To track a Purchase, you have to specify the purchase ID, the currency, and then the array of items purchased :

          Currency should be a valid 3 letters ISO4217 currency (EUR,USD,..)

          Update Device Info

          You can create a device profile for each device by adding different pieces of information about the user/device (for example whether the user is opt in for or out of some categories of notifications). Device information is a set of keys/values that are sent to Accengage servers. In order to update information about a device profile, add the following lines to your code :

            Since 1.1.1 version, you can use the new Update Device Information method, where you can set a value, delete it, or increment/decrement it (if it's a number).


            This method is deprecated since version 1.1.1

            We recommend you to use the new method in the tab "New"



            The keys and values must match Accengage user information field names and values to allow information to be correctly updated. To create these fields, follow the User Guide.
            But please note that they MUST be sent in String format when calling updateDeviceInfo() method !


            You can specify the view that you want the SDK to track:

                    Don't forget to specify when the tracked view has been dismissed:

            Static Lists

            You can subscribe or unsubscribe to Static Lists, so you can later target specific users from a list to send them Push Notifications or In-App messages for example.

            You must send an Array containing one or more lists to the method "subscribeToLists", with their ID (defined in the Accengage interface), and an expiration date (optional), in unix timestamp.

            You can also check the subscription status from a list, with the method "getSubscriptionStatusForLists" that will return a string status, either "Subscribed", "Unsubscribed", or "Unknown".

            Finally, you can also retrieve all the Static Lists to which the user has subscribed :

            Subscription Tags 

            Since 1.1.1 version, Subscription tags are avaiable.

            Subscription tags is an API used to mark user interest for a particular topic, and then target them :

            "items" is a dictionnary of custom parameters, with a key and value. Value can be a date, a number or a string.


            You can then unsubscribe from a device tag :

            Please note that this feature is only available through Accengage's API

            For more information please contact our Support Team at http://ticket.accengage.com


            States like events allow you to trigger In-App messages or scheduled alarms. However for states there are two differences : 

            • states are not transmitted to the server
            • you can trigger messages by state values and not just by state ID (event ID)

            As for events, states must be declared firstly in the Accengage dashboard.

            In order to set/update the state value you need to call putState :


              Optin Control

              Since 1.1.0, you can be more easily GDPR-compliant, by keeping the SDK off until your user accepts that their data will be collected.
              There are two different Optin types :

              • OptinData : Everything, every data that the SDK can collect. If it's set to false, the SDK will not be running, so you will not be able to track your user.
              • OptinGeoloc : Only geolocation data is concerned. If it's set to false, the SDK will not collect the location of your user, but they can still receive push notifications, In-App messages...

              If OptinData is set to false, the state of OptinGeoloc will not be considered.


              You can use these methods to modify the Optin state :

              You can also use these methods to check the current Optin state :
              They return true or false.



              Activate logs

              Certain SDK features don't seem to work? You can enable logging in order to see what's going on.

                To do so, simply add the following string to strings.xml :


                Also, you can disable the toast displayed when the application is started:


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

                Restrict SDK connection

                You can temporarily disable the SDK network calls:

                All requests will be suspended until you call setNetworkCallsEnabled(false). In order to know if the network calls are enabled, please use:

                Enable/Disable Location Services

                You can enable geolocation, geofence and beacon services at any time by calling:

                To disable geolocation, geofence and beacon services, simply use the following:

                • No labels