Omnisense Android SDK

Import SDK in your project

Before installing Omnisense, you should follow this link which explain how to integrate GCM inside your app :

Note : You must provide a google-services.json config file.

Open your project. Click on File > New > New Module. Select "Import .JAR/.AAR package". Select the provided omnisense.aar package.

Add the following: In settings.gradle

include ':app', ':omnisense' //Append :omnisense to the list of included modules

In the main (top-level) build.gradle

dependencies {
        classpath ''
        classpath ''

In app's build.gradle

dependencies {
compile project(':omnisense')

//Add at the bottom of the file
apply plugin: ''

In AndroidManifest.xml (Replace "yourpackage" by your app's package) Replace omnisense_api_key and omnisense_app_identifier values according to your credentials. The omnisense_app_identifier is the beginning of your Omnisense instance URL. Example: If instance's URL is "" then myinstance is your identifier.

        android:protectionLevel="signature" />
<uses-permission android:name="yourpackage.permission.C2D_MESSAGE" />

<application ...>
   <meta-data android:name="omnisense_api_key" android:value="your_api_key" />
   <meta-data android:name="gcm_sender_id" android:value="@string/gcm_defaultSenderId" />
   <meta-data android:name="omnisense_app_identifier" android:value="your_app_identifier" />

        <action android:name="" />

        <category android:name="yourpackage" />

        <action android:name="" />

In the onCreate function of your class extending "Application"

   Omnisense.getInstance().getNotificationConfig().setPushListener(new PushReceptionListener() {
      public void onPushReceived(JSONObject extras) {
         This is a basic config. The extras object contains the params sent by Omnisense.
         If the extras already contains "u" param, then a deep linking is already present in the extras. Otherwise, you can create your own deep linking according to the provided param then add it to the "u" param. */

      public void onNotificationDisplayed() {


   Omnisense.getInstance().initialize(); //Must be called before anything else

In each activity, you have to add this :

public void onStart()

public void onStop()

User data recording

User profile management

To identify the user on Omnisense (after login or sign up), simply update the fields on the OmnisenseUser provided by the instance :

OmnisenseUser user = Omnisense.getInstance().getCurrentUser(); = "";
user.fb_id = "12143534535646";
user.firstName = "John";
user.lastName = "Doe";

To identify a user on Omnisense, an email OR the Facebook ID must at least be set. If not, other attributes won't be sync with Omnisense.

If you want to add or update some of the user attributes, you can get the current user with the method getCurrentUser and change the values. You will have to call the saveUser after settings the values in order to save them to Omnisense.

After a "log out", simply call the resetCurrentUser to remove the current user.

User custom events recording

To record an event made by the user in the app, call the record event method with segmentation.

Segment segment = new Segment();
segment.put("product_name", "The best product ever");
segment.put("category", "New stuff");
Omnisense.getInstance().recordEvent("product_view", segment);

The segmentation is a hash of event parameters that only contains string values.

Conversion data

In case you want to use Omnisense conversion data at first launch in your app, you can use the following method before "initialize" method.

    Omnisense.getInstance().setTrackingListener(new OnOmnisenseFingerprintListener() {
        public void onOmnisenseFingerprintCompleted(Map<String, String> map) {

Facebook app installs

To track Facebook app install, set a specific Omnisense link into the deferred app link parameter of your Facebook campaign. Use method handleFacebookDeferredAppLink to handle the Facebook deferred app link with Omnisense.

    new AppLinkData.CompletionHandler() {
        public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
            if(appLinkData!=null) {


Copyright (c) 2016 I See U. All rights reserved.