Skip to main content
Print

With Android TV and FireTV apps in Kotlin

Overview

In order to include or capture feedback on CuVo, you need to integrate your Android mobile with Kotlin library. This guide shows how to successfully complete the necessary steps involved in the integration.

It helps you understand all the essential parts of the integration such as downloading the CuVo feedback agent library, adding it as a dependency and integrating the necessary code.  You will also find more customization options for showing the CuVo form on the selected actions, submitting custom data with feedback, setting custom values to submit feedback and showing or hiding the CuVo feedback button.

These steps are easy to follow and take about 2 hours to complete the whole process successfully. 

Supported Versions

Android 11 or Higher

Android 11-api level 30 and above

Download CuVo Feedback Agent Library

To begin the process of integration, you need to first download the CuVo feedback agent library. 

1. Log into the CuVo portal using the link –https://dashboard.cuvo.io.

2. After onboarding, navigate to Products > Edit Product > Integration Steps.

For more information, refer to Integrating Cuvo Agent

Note:  The downloaded file is saved as .aar file in your local directory.

Add Cuvo Library as a Dependency in Your App

Once you have the CuVo agent feedback library file, you need to add it as a dependency in your app to facilitate the integration. 

1. Navigate to File > Project Structure.

2. Navigate to Dependencies > Declared Dependencies tab.

3. Click the Add icon.  

4. Then, select JAR/AAR Dependency from the dropdown list.

5. In the Add JAR/AAR Dependency dialog, enter the folder path of the downloaded library file as Step 1.

6. In Step 2,  assign your dependency to a configuration by selecting 
The configuration as Implementation from the drop-down list.

7. Click OK.

8. Click Apply.

Note: Once you apply the dependency file, you can see its path in the app’s build.gradle file. 

Integrate Code 

To initialize the CuVo library, you need to add the list of queries and activities from the CuVo library in the main application’s AndroidManifest.xml file.

1. Navigate to your App in Android studio and open AndroidManifest.xml file. 

2. Add the following code at the end of the file.

<uses-permission android:name="android.permission.RECORD_AUDIO" />

<queries> 

<intent> 

<action android:name="android.speech.RecognitionService" /> 

</intent> 

</queries>

<activity android:name="com.example.cuvotvkotlinlibrary.CuvoActivity" android:theme="@style/Theme.AppCompat.Light.Dialog" 

android:label="loading..."/> 

 3. Navigate to the main activity file of your app and open it. 

4. Search for onCreate() function. 

5. Add the below code at the end of the onCreate() function.

var productDetails = JSONObject() 

 productDetails.put("endPoint", <Endpoint>) 

 productDetails.put("productVersion", <version>) 

 productDetails.put("prodId", <product id>) 

 productDetails.put("orgId", <organization id>) 

 productDetails.put("apiKey", <product api key>) 

 productDetails.put(“isDarkMode”, true)

 CuvoInitConfigs.createCuvoActivity(productDetails) 

6. Select the activity where you want to include CuVo feedback.

7.  Create a Button view and call the CuVo library in the click event listener of the button. 

var bt: Button = findViewById(R.id.btSample) 

bt.setOnClickListener {

     if(CuvoInitConfigs.cuvoReady){ 

     var df: Fragment = CuvoDialogFragment.newInstance() 

  supportFragmentManager.beginTransaction().add(df, CuvoDialogFragment.TAG).commit() 

  } 

} 

Additional Customizations During Integration

An object called  CuvoInitConfigs is created at the global level for maintaining the data and state of the CuVo feedback agent.  You can use the APIs and Properties of the CuvoInitConfigs object for the following purposes:

  • Show the CuVo Form on Actions  – You can show the CuVo form on actions such as page change, timeout, lack of user activity, etc.
  • Submit the Custom Data about the User or Application Context  – You can customize to submit the custom data along with feedback, bug, or request submissions. 
  • Set the Custom Values in the Form – You can set the custom values in the form to eliminate the need for users to enter them while submitting feedback, bugs, or requests.
  • Show or Hide the CuVo Feedback Button – You can also selectively show or hide the CuVo feedback button.

Show the CuVo Form on Actions

Call the following method in the required event listener handler.

CuvoInitConfigs.showFeedbackForm()

Submit the Custom Data about the User or Application Context 

1. Add the following code to set the User details from your application to CuVo library.

var userDetails = JSONObject() 

userDetails.put(“email”, “testtv@gmail.com”) 

userDetails.put(“role”, “Developer”) 

CuvoInitConfigs.setUserDetails(userDetails)

2. Add the code below to set the context details from your application to CuVo library.

var contextDetails = JSONObject() 

contextDetails.put(“page”, “guide page”) 

contextDetails.put(“action”, “guide menu click”) 

CuvoInitConfigs.setContextDetails(contextDetails) 

Set the Custom Values in the Form 

1. To preset the email of the user when the user is logged in to the app use the following method:

CuvoInitConfigs.setEmail(emailId)

2. To pre-select the category value depending on the application context the user is in while invoking feedback use the following method: 

CuvoInitConfigs.setCategory(categoryName)

Show or Hide the CuVo Feedback Button

Use the following methods to  hide or show the feedback button selectively on appropriate event listeners in the apps and their sub menu items: 

CuvoInitConfigs.hideButton() 

CuvoInitConfigs.showButton()

Table of Contents