Getting Started
Step 0: Have an active Moki account
Before you start, you should already have an account on app.moki.com. If you do not have one, request a demo.
You will need your App Key, App Id, and Tenant ID. This can be found by doing the following:
- Login to the dashboard at app.moki.com
- Click on the account name in the upper right corner
- Click on “Account Settings”
- Click on the “Developer Tools” section, identified by the toolbox icon
- The Tenant ID is listed towards the top
- The App Key and App Id can be found associated with each app
Step 1: Install Agent
Agent 3.0+ is a pre-requisite for the sdk. It must be installed and enrolled before anything can be done within an app containing the sdk.
Step 2: Setup build.gradle
-
Include this repository:
maven { url 'https://storage.googleapis.com/moki-maven/' }
It may look something like this
repositories { maven { url 'https://storage.googleapis.com/moki-maven/' } mavenLocal() mavenCentral() }
-
Include this dependency:
compile 'com.moki:manage-sdk:2.3.0'
It may look something like this
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.moki:manage-sdk:2.3.0' }
Step 3: Setup AndroidManifest.xml
Include these receivers:
<receiver
android:name="com.moki.ipc.IPCResponseReceiver"
android:enabled="true"
android:exported="true">
<intent-filter android:priority="0">
<action android:name="com.moki.ipc.AGENT_IPCService" />
</intent-filter>
</receiver>
<receiver
android:name="com.moki.ipc.IPCMessageReceiver"
android:enabled="true"
android:exported="true" >
<intent-filter android:priority="1000">
<action android:name="com.moki.ipc.SDK_IPCService" />
</intent-filter>
</receiver>
Step 4: Initialize
The best place to do this is in your extended Application class.
-
Access your app key and app id
These can be found on app.moki.com and correlate to your account.
public static final String APP_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; public static final String APP_ID = "xxxxxxxxxx";
-
Initialize the sdk with the following function call
MokiManage.sharedInstance(APP_KEY, APP_ID, this);
For ease it is best to extend the android.os.Application class and specify that class name in your manifest like so:
<application android:name=".ExampleApplication"
Example Application Class
Below is an example of what is needed in the subclass of android.os.Application.
public class ExampleApplication extends Application {
public static final String APP_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
public static final String APP_ID = "xxxxxxxxxx";
@Override
public void onCreate() {
super.onCreate();
MokiManage.sharedInstance(APP_KEY, APP_ID, this);
}
}