Getting Started With Android Integration

Step by step guide to help you get Jiny's SDK integrated in your app


  • You will need the API key which can be accessed via dashboard

Integration Steps

Step 1: Add the Jiny library dependency

To your module (app-level) Gradle file (usually app/build.gradle), add the dependencies for Jiny library.
dependencies {
implementation 'com.jiny.android:sdk:0.0.48'
For AndroidX support add the following
dependencies {
implementation 'com.jiny.androidx:sdk:0.0.37'

Step 2: Create Application class

Create a custom Application if you don't have one. Register the Application class you created in the AndroidManifest.xml as follows
android:name=".<name of the application class>"

Step 3: Initialise Jiny SDK and set environment

You are required to initialise Jiny SDK in your Application class using onCreate() function. Also, before a production release, the environment must be pointed to a non-production one. You can enable the test environment by following the below steps
For internal testing purposes, use the setIsTest(true). For production or pilot environment use the setIsTest(false)

Initialise Jiny SDK with unique user ID

Jiny uses google ad ID to identify unique users by default. If you do not want Jiny to use google ad ID, you can disable it and use your own unique user ID when you initialise Jiny.
Make sure the user ID is unique to prevent any inconsistencies in analytics event

Proguard rules

If you are using Proguard for your builds, add the following rules in yourproguard-rules.pro file
-dontwarn com.jiny.android.**
-keep class com.jiny.android.** {*;}

WebView support

If you want to Jiny to run in the Activity/Fragment which contains WebView then you must add the following code before yourWebViewInstance.loadUrl()
Warning: CallingJinySDK.enableWebInterface(yourWebViewInstance)after loadUrl() method may lead to inconsistencies.
If you have scaling enabled in your WebView make sure you send the new scale to Jiny SDK by calling JinySDK.updateWebViewScale(newScale).You can get the new scale value of the WebView by overriding onScaleChanged method in your WebViewClient. You can refer the below code.
webView.setWebViewClient(new WebViewClient() {
public void onScaleChanged(WebView view, float oldScale, float newScale) {
super.onScaleChanged(view, oldScale, newScale);

App Locale

If you want to enable Jiny's assistance on localised app, call this method by passing the current locale user has selected. Find the list of locales supported by Jiny here
Make sure to pass a locale which is subscribed by you, otherwise Jiny assistance won't work for that locale!

Audio ducking

Jiny supports audio ducking but if you have ExoPlayer, and you expect Jiny to duck audio on that window then refer the following snippet. (Ignore this if you have already handled audio focus)
Create an instance ofcom.google.android.exoplayer2.audio.AudioAttributes that matches your use case. You need to pass handleAudioFocus as TRUE while setting the audioAttributes. Refer to this link or to the example below:
AudioAttributes audioAttributes = new AudioAttributes.Builder()
/* handleAudioFocus= */ true);

Disable Jiny

In case you want to disable Jiny SDK, use the following method