Skip to content

Android SDK

The Instaply SDK opens a conversation between your customer and a representative inside your Android app.

In your root build.gradle / settings.gradle (depending on your Gradle setup), add the Instaply Maven repository. Legacy documentation used:

repositories {
jcenter() // deprecated; migrate to mavenCentral or your mirror as appropriate
maven {
url "https://nexus.instaply.com/repository/android"
}
}

In the module build.gradle, add the SDK artifact (version from legacy docs):

android {
// ...
dependencies {
implementation(group: 'android', name: 'instaply-sdk', version: '1.0.19', ext: 'aar')
}
}

Confirm the current artifact coordinates and version with Instaply.

Required / common

  • INTERNET
  • WRITE_EXTERNAL_STORAGE — needed to send a photo from the SDK

Optional (connectivity UX)

  • ACCESS_NETWORK_STATE

Push (if used)

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="APP_PACKAGE_NAME.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="APP_PACKAGE_NAME.permission.C2D_MESSAGE" />

Replace APP_PACKAGE_NAME with your application id (for example com.example.app).

The SDK historically depended on:

compile 'com.android.support:appcompat-v7:21.+'
compile 'com.google.code.gson:gson:2.+'

Resolve any classpath conflicts against these versions (or their AndroidX equivalents if you migrate).

  • Minimum Android API 14 (legacy doc)
  • Locales: English, French, Swedish (locale follows the host app)

Prefer your Application subclass:

InstaplySharedAPI instaplySharedAPI = InstaplySharedAPI.sharedAPI(getApplication());

Build an Authentication object:

Authentication auth = new Authentication(apiKey, nonce, digest, customerId, businessId, gcmRegId);
instaplySharedAPI.authenticate(auth, loginResponseHandler);
ArgumentMeaning
apiKeyYour Instaply API token
nonceRandom nonce used to compute digest
digestSHA1 verification token (see SDK authentication)
customerIdStable customer identifier (email, phone, etc.)
businessIdInstaply business / store id
gcmRegIdFCM/GCM registration id — optional unless you use push

InstaplyAPILoginResponseHandler receives onLoginSuccess or onLoginFailed.

  • You do not need to authenticate on every use; after success, credentials are stored.
  • instaplySharedAPI.isAuthenticated() checks state.
  • instaplySharedAPI.setOnAuthenticationExpiredCallback(...) handles token expiry.
  • instaplySharedAPI.getAccountManager().clearIdentity() clears the user and token.
instaplySharedAPI.getUIManager()
.activityTitle("Title")
.activitySubtitle("Subtitle")
.prefillMessage("Do you have ")
.hint("Message...")
.startConversationActivity(context);
instaplySharedAPI.getUnreadCount(new InstaplySharedAPI.InstaplyAPIUnreadCountResponseHandler() {
@Override
public void onUnreadCountResponseReceived(InstaplySharedAPI api, int unreadCount) { }
@Override
public void onUnreadCountResponseError(InstaplySharedAPI api) { }
});
User user = new User();
user.setFirstName("John");
user.setLastName("Doe");
user.setEmail("john@doe.com");
user.setPhone("+33123456789");
user.setAdditionalField("my-business-client-id", "23829");
user.setProfilePicture(bitmap);
instaplySharedAPI.getAccountManager().setUser(user);

Profile pictures are limited to 1024×1024; the SDK does not resize images for you.