Installation

Last updated 2 months ago

Add below line to ‘dependencies’ section of your app's build.gradle or import jsdk-release.aar file into the project.

  • compile jiny.thinsdk.android.snapshot:merchantsdk:x.x.x

    x.x.x must be replaced by the latest and compatible version of the SDK as mentioned in release notes.

  • Add the following dependencies in build.gradle file of your application.

    compile group:'com.fasterxml.jackson.core',name:'jackson-databind',version:'2.5.3'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.squareup:otto:1.3.8'
  • Add the below line to the onCreate method of your Main Application class.

    try{
    Jiny.init(this,Map<String,String> initParams);
    }catch(JinyInitException jinyInitException){}

    initParams is a map consisting of set of key value pairs for identifying a user.

    "user_id"="[user id]",
    "api_key"="[api key]",
    "language"="[language]",
    "default_status"="[status]"

    [user id] is the user identification variable which will enable us to differentiate between any 2 users.

    [api key] is the client api key which will be mailed to the POC.

    [language] is the default language(audio/text) of the jiny interface.

    1. Current language support is for Hindi,English. Different languages can be added.

    2. If it is not set initially then user will be prompted to select a language when the app is opened for the first time else it will be "hindi" or "english" based upon the value given to [language] variable.

    [default status] values can be "on" or "off". If it is "off" then user will be prompted to whether he/she wants to use jiny's audio visual experience. If it is "on" then user will be directly asked the about his/her intention through Jiny Audio Visual Interface.

  • Add the below code snippet to onCreate and onResume methods of every Activity class.

    JinyView jinyView = new JinyViewBuilder()
    .setView(this.getWindow().getDecorView())
    .build();
    Jiny.onWindowRendered(this,jinyView);

    Also add the following lines of code to onResume methods of every fragment class.

    JinyView jinyView = new JinyViewBuilder()
    .setView(getActivity().getWindow().getDecorView())
    .build();
    Jiny.onWindowRendered(getActivity(),jinyView);

    Make sure that Jiny.onWindowRendered is called after the view is rendered on the screen.

    1. If some views are populated after a network call then Jiny.onWindowRendered function should only be called after successful completion of the network call.

    2. Jiny.onWindowRendered should be added to OnPostExecute Method of AsyncTask or to onResponse Method of Volley

  • Add the below line to onStop of every Activity class.

    Jiny.onViewDestroyed();
  • Implement the following code when the application is getting destroyed/closed.

    Jiny.endSession();

    This will clear the Jiny Cache