table of content - contentcdn.azureedge.net android sdk... · cloudcherry android sdk manual table...

17
CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup 2 4. How to create static token 3 5. Initialize SDK 5 6. How to trigger the SDK? 5 7. How to setup custom legends for NPS Question 6 8. How to set up conditional text 8 9. How to set up conditional flow 10 10. How to set pre-fills in the SDK 12 11. How to setup callback to capture analytics data 13 12. Dynamic Token Generation 14 Configuring Survey token during creation 14 13. Style Configurations 15 of 1 17

Upload: phamdieu

Post on 06-Mar-2018

233 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

Table of Content

1. Introduction: cloudcherry-android-sdk 22. Capabilities 23. Setup 24. How to create static token 35. Initialize SDK 56. How to trigger the SDK? 57. How to setup custom legends for NPS Question 68. How to set up conditional text 89. How to set up conditional flow 1010. How to set pre-fills in the SDK 1211. How to setup callback to capture analytics data 1312. Dynamic Token Generation 14

• Configuring Survey token during creation 14

13. Style Configurations 15

� of �1 17

Page 2: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

1. Introduction: cloudcherry-android-sdk

An open-source library that helps you integrate Cloudcherry into your Android app

2. Capabilities

1. Trigger pre-existing surveys and render it on Android phone.2. Handles visual attributes set up on Cloudcherry dashboard, such as

1. Welcome & Thank you message2. Company logo3. Header and Footer color4. Type face and Text color

3. Dynamic token creation1. Single/multi use2. Handles Location

4. Handles underlying question types1. Single Response

1. Smile Rating2. Star Rating3. Range

1. Scale(NPS)4. Custom Text icons

2. Multiple Response3. Text Entry

1. Multi-line Text Box5. Pre-fills

1. Handles pre-fills questions set up on Cloucherry dashboard2. Configures pre-fill questions locally -using Question Tags as the reference.

6. Handles partial responses.7. Provides in-app survey analytics.

3. Setup

We support API 14 (4.0) and above, and we recommend you use a compileSdkVersion of 24.

� of �2 17

Page 3: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

4. How to create static token

1. Login to your Cloudcherry account to access your dashboard

2. Click on Token Management option on the side menu.

� of �3 17

Page 4: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

3. Click on Create a Token button to open token creation window.

4. On token creation window fill the necessary fields and click on Add button.Best Practise: Always create static tokens with unlimited usage(by setting “Number of uses” field value to -1.), unless you are using it for limited users.For single use per person, you can refer to section 12 - How to create dynamic tokens.

� of �4 17

Page 5: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

5. Initialize SDKYou can initialize the SDK by using the underlying code in the onCreate() method of your application class:

Note: Here PK-3057 is the static token obtained from the Cloudcherry dashboard.

6. How to trigger the SDK?

This is straight forward. All you need to do is call the underlying method.

Example of triggered survey within the app:

� of �5 17

SurveyCC.initialise(this, "PK-3057");

SurveyCC.getInstance().trigger();

Page 6: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

7. How to setup custom legends for NPS Question1. Click on Questionnaire on the side menu.2. Create an NPS (Net Promoter Score) type question by clicking on the Add Question

button.3. Click on the ACTION button to get a list of edit options.

4. Click on Modify option to open Question Edit window.

� of �6 17

Click

Click

Page 7: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

5. Now fill in the Optional Legend field and click on Update button to set custom legends for min and max values.

Example of Custom Legend within the app:

� of �7 17

Click

Page 8: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

8. How to set up conditional text

Conditional text is used to display different “question text” for a particular question based on priorly answered questions.

1. Click on Questionnaire option on the side menu.2. Click on the ACTION button of a question which needs to display conditional text 3. Click on Conditional Display Texts option to open Conditional Display Text window.

� of �8 17

Click

Page 9: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

4. Click on Create to add a Conditional Question Text5. Click on Set Conditions to define the condition for the Question Text.

6. At last click on Save button to save your changes.

� of �9 17

Click

Page 10: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

9. How to set up conditional flowConditional flow is used to display different “questions” based on priorly answered questions.

1. Click on Questionnaire option on the side menu.2. Click on the ACTION button of a question which needs to be displayed or hidden based

on certain conditions.3. Click on Modify option to open Question Edit window.4. On the Question Edit window click on Advanced Options which opens up the advanced

option list.5. Mark Make this a conditional question option as checked and set the required

conditions for the questions whose answer decides whether to display or hide this question.

� of �10 17

Page 11: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

6. Now click on Add Condition button to save the condition that you have set. You can also set multiple conditions on the same or different questions.

7. At last click on Update button at the bottom of the window.

� of �11 17

Page 12: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

10. How to set pre-fills in the SDKPre-fill answers can be set before triggering the SDK via a HashMap.

1. In the dashboard click on Questionnaire option on the side menu.2. Click on the ACTION button of a question for which you want to pre-fill answers in the

SDK.3. Click on Modify option to open Question Edit window.4. On the Question Edit window click on Advanced Options which opens up the advanced

option list.5. Add the Tag(Ex: preFillMobile) that acts as a filter to pre-fill answer while submitting

answer to server.

6. At last click on “Update” button at the bottom of the window.

� of �12 17

HashMap<String, Object> aAnswers = new HashMap<>();        aAnswers.put("preFillMobile", "988*******");        aAnswers.put("preFillEmail", "[email protected]");        SurveyCC.getInstance().setPreFill(aAnswers);        SurveyCC.getInstance().trigger();

Note: Here “preFillMobile” is a Tags created on the Cloudcherry Dashboard. This Tag is used as a filter to pre-fill answers.

Page 13: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

11. How to setup callback to capture analytics dataRegister analytics listener in the onCreate() method of your Activity

Un-Register analytics listener in the onDestroy() method of your Activity

� of �13 17

@Override    protected void onDestroy() {        super.onDestroy();        SurveyCC.getInstance().removeAnalyticsListener(this);    }

@Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        SurveyCC.getInstance().setAnalyticsListener(this);    }

Page 14: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

12. Dynamic Token GenerationDynamic-tokens can be created while initialising the SDK using the underlying syntax.

• Configuring Survey token during creationSurveyToken class constructor takes two parameters.* validUses - Number of times the generated token can be used.* location - Location Tag to filter questions based on location

If you want to configure SDK to capture partial response and create a single use token then pass validUses = 1If you want to create SurveyToken for unlimited usage then pass validUses = -1If configuration parameters are not set, then the default value for validUses = -1 and location = null.

Note: 1. Enabling partial response ensures that the user response is collected after each question and does not wait until the user hits submit button at the end of the survey.This is ideal for mobile app users, as the users may be interrupted by phone calls.2. Creating unlimited use token is not recommended. This creates junk tokens in your account.

� of �14 17

SurveyCC.initialise(this, "Cloudcherry Username", "Cloudcherry Password”, SurveyToken iTokenConfig);

SurveyToken aTokenConfig = new SurveyToken(1, “mobile");

public class SampleAppApplication extends Application {    @Override    public void onCreate() {        super.onCreate();        SurveyToken aTokenConfig = new SurveyToken(1, "mobile");        SurveyCC.initialise(this, "abcd", "test12345", aTokenConfig);    }}

Page 15: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

13. Style Configurations

1. Custom Text Icon Question: Style for “Custom Text Icon” options can be configured by using setCustomTextStyle() method. Custom text style has two options1. CustomTextStyle.STYLE_CIRCLE (default)2. CustomTextStyle.STYLE_RECTANGLE.

Example is shown below:

� of �15 17

SurveyCC.getInstance().setCustomTextStyle(CustomTextStyle.STYLE_CIRCLE);

Page 16: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

2. Star Rating Question:Style for “Star Rating Question” can be configured by using setStarRatingSelector() method. Star Rating uses yellow star asset by default.To use your own assets for the star, please provide ArrayList of resource IDs of your selector drawables with selected and unselected state while initialising SDK.Example is shown below:

Example for star rating selector is shown below:

� of �16 17

SurveyCC.getInstance().setStarRatingSelector(aStarRatingSelector);

<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/star1" android:state_selected="false" /> <item android:drawable="@drawable/star1_on" android:state_selected="true" /> <item android:drawable="@drawable/star1" /></selector>

Page 17: Table of Content - contentcdn.azureedge.net Android SDK... · CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup

CLOUDCHERRYAndroid SDK Manual

3. Smiley Rating Question:Style for “Smiley Rating Question” can be configured by using setSmileyRatingSelector() method. Smiley Rating uses emoji unicode by default.To use your own assets, please provide ArrayList of resource IDs of your selector drawables with checked and unchecked state while initialising SDK.Example is shown below:

Example for smiley rating selector is shown below:

Thank you.

� of �17 17

SurveyCC.getInstance().setSmileyRatingSelector(aSmileyRatingSelector);

<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable=“@drawable/smiley1" android:state_checked="false" /> <item android:drawable=“@drawable/smiley1_on" android:state_checked="true" /> <item android:drawable="@drawable/smiley1" /></selector>