Documentation

Overview

Welcome to Chap SDK! Chap SDK is the location context platform. You can use Chap SDK to add location context to your apps with just a few lines of code.

In this overview, we introduce the core concepts of Chap SDK. After the integration, the SDK allows you to get access to the personalized Dashboard of your company. In the dashboard, you will be able to choose a variety of features including:

– Create Geo Marketing Campaigns
– User Heat Map
– Performance analytics
– Simplified Data import
– Advanced campaign options
– Location Lookup function

The rest of the documentation explains these concepts in more detail.

SDK Integration

This document describes the steps to integrate ChapApp SDK to your project.

  • Before you start
  • Add to Android Studio
              1. Add attribute
              2. Include dependencies
              3. Create a new module
              4. Import .JAR/.AAR package
              5. Synchronize gradle project
              6. Change minSDKVersion
              7. Include compileOptions
  • Firebase Integration (mandatory)
              1. onCreate() function
              2. Build and run the project
  • customizations

Before you start:

To get started, you need a unique API  key which is to be placed in the Strings file of your project.

  • Add the API key to the strings file in the values folder of your project.

<string name=“unique_api_key”>api_key_value</string>

Also, you need a Google Map API key which is to be placed in the Android Manifest file of your project.

  • Add the API key to the Application tag of the Manifest file of your project.

<meta-data
  android:name=“com.google.android.geo.API_KEY”
  android:value=“@string/google_maps_key”/>

Add the Chap SDK to your Android Studio project:

1. Add the following attribute in Application tag of Manifest file of your project. The attribute is to be added to avoid merger conflicts.

tools:replace=“android:icon,android:roundIcon”

2. In your app build.gradle, include the following dependencies.

dependencies {

implementation ‘com.google.android.gms:play-services-maps:17.0.0’
implementation ‘com.google.android.gms:play-services-drive:17.0.0’
implementation ‘com.google.android.gms:play-services-location:17.0.0’
implementation ‘com.google.maps.android:android-maps-utils:0.5+’
implementation ‘com.android.support:design:28.0.0’
implementation ‘com.squareup.okhttp3:okhttp:3.12.1’
implementation ‘com.squareup.retrofit2:retrofit:2.4.0’
implementation ‘com.google.code.gson:gson:2.8.5’
implementation ‘com.squareup.retrofit2:converter-gson:2.1.0’
implementation ‘com.squareup.okhttp3:logging-interceptor:3.4.1’
implementation ‘com.github.bumptech.glide:glide:4.7.1’
annotationProcessor ‘com.github.bumptech.glide:compiler:4.7.1’
implementation ‘com.karumi:dexter:4.2.0’
implementation ‘com.android.support:multidex:1.0.3’
implementation ‘com.crashlytics.sdk.android:crashlytics:2.10.1’
implementation “com.google.ar.sceneform.ux:sceneform-ux:1.11.0”
implementation “com.google.firebase:firebase-messaging:20.0.0”
implementation “com.google.firebase:firebase-core:17.1.0”

}

3. To add the SDK, go to File -> Project Structure -> Modules -> Click the ‘+’ button to create a new module.

4. Select Import .JAR/.AAR package , select the path for chapapp.aar, Click ‘Ok’ and  let the gradle project sync.

5. Go to File -> Project Structure -> Dependencies, Select your project’s App module, its dependencies gets loaded in right side panel. Click the ‘+’ icon in Declared Dependencies to include Module dependency. Select the module name created above, Click Ok and let the gradle project sync.

6. In your app build.gradle, change the minSdkVersion to 16 in defaultConfig.

android {
        defaultConfig {
              minSdkVersion 16
        }
}

7. In your app build.gradle, include the compileOptions in android section.

android {
        compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
        }
}

Firebase integration (mandatory)

  • Configure Firebase for your project.
  • Go to your project in Firebase console. In the left panel, find Project Overview. Click the Settings icon and go to Project Settings. 
  • In General tab, find the ‘google-services.json’ file. Download this file and add it to the app folder of your project.
  • Now, click the Cloud Messaging tab and find the server key. Copy this server key and add the Server key to the strings file in the values folder of your project.

<string name=“authKey”>key=YOUR_SERVER_KEY</string>

  • In your project build.gradle, add “classpath ‘com.google.gms:google-services:4.3.1’in the dependencies section under buildscript.

buildscript {
            dependencies {
            classpath ‘com.google.gms:google-services:4.3.1’
            }
}

  • In your app build.gradle, add “apply plugin: ‘com.google.gms.google-services’“ at the end.
  • Add MyFirebaseMessingService (see file) and in the onMessageReceived function add the following code

Intent broadcastIntent = new Intent(this, LocationUpdatesBroadcastReceiver.class);
broadcastIntent.setAction(LocationUpdatesBroadcastReceiver.ACTION_NOTIFICATION_RECEIVED);
broadcastIntent.putExtra(“remoteMessage“,remoteMessage);
this.sendBroadcast(broadcastIntent);

  • In the LauncherActivity of your project, include the following in onCreate() function:

FirebaseApp.initializeApp(this);
FirebaseInstanceId.getInstance().getInstanceId()
.addOnCompleteListener(task -> {
// Get new Instance ID token
String token =
Objects.requireNonNull(task.getResult()).getToken();
Intent i = new Intent(MainActivity.this, ChapSplashActivity.class);
i.putExtra(“mainCalled“, false);
i.putExtra(“firebaseToken“, token);
i.putExtra(“authKey“,getString(R.string.authKey));
i.putExtra(“unique_api_key“,getString(R.string.unique_api_key));
startActivity(i);
});

FirebaseMessaging.getInstance().setAutoInitEnabled(true);

The ChapSplashActivity is called to provide the required permissions for SDK and background location service. Once those have been provided by the user, it would be returned back to the parent screen.

  • Build and Run the project.

Customizations

1. Change Notification Icon:
Add a notification icon to mipmap with name ‘chap_notification_icon’. This will be applied as notification icon when the notification been shown to user.

2. Map and collected items yes/no?

3. AR yes/no?

4. Notification text changes

Run Chap SDK Map:
Intent in =
new Intent(FullscreenActivity.this, ChapSplashActivity.class); in.putExtra(“mainCalled”, true); startActivity(in);

Contact Support

LEGAL

Impressum
Privacy Policy
Cookie Policy