With Android Mobile app in Kotlin
Overview
In order to include Cuvo feedback system, you need to integrate your Android mobile app with the Cuvo feedback library. This guide shows how to successfully complete the necessary steps involved in the integration.
The last section lists all the API methods exposed by the library for additional customisation handle on the agent.
The following is the list of version compatibility for the feedback agent:
Android Version Support: Android version 11 and above
Minimum SDK Version: Android SDK 21
Target and compile SDK Version: Android SDK 34
Java Version: Java 8 and above
Android Gradle Plugin (AGP) Version: 1.6.10 and above
Gradle Distribution URL: 7.2.0 and above
Adding CuVo Library as a Dependency in Your App
After creating an account and configuring the feedback agent, you will see the Integration steps section. Generate an API key (if not already generated), select Mobile for Platform and Android Kotlin for Technology. Check the checkbox for Enable Integration to view the Agent Integration Details portion.
Now you have the code snippet and integration instructions for integration with your kotlin app for android mobile.
- Add the following maven repo details to your build.gradle file at the project level.
maven {
url = uri("https://maven.pkg.github.com/Cuvo1/
cuvoandroidfbagent")
credentials {
username = (project.findProperty("gpr.user") ?:
System.getenv("USERNAME")).toString()
password = (project.findProperty("gpr.key") ?:
System.getenv("TOKEN")).toString()
}
}
2. Add the following credentials received from Cuvo team in your gradle.properties file at the project level.
# Cuvo creds
gpr.user=integrating-app
gpr.key=ghp_Xk1D9ZLp7yBwLMvJf2OgqF7xRDS9sZ3YwAqz
3. Add the library to your build.gradle file of the required module
implementation "ai.cuvo:feedbackagent:1.0.11@aar"
Note: Use the latest version as shared by Cuvo team.
Integrating Code
To integrate the code, follow the steps below.
- Initialise the feedback agent as below in you MainActivity
Copy the code snippet you see in the Code Snippet box of the Integration steps section on the CuVo portal and add it to the onCreate() function in the MainActivity to initialize the Cuvo Library. The code snippet will look like the below code with appropriate values for the APIKEY_VALUE, ORG_ID_VALUE, PROD_ID_VALUE, PRODUCT_VERSION_VALUE and CHATBOT_IMAGE_URL filled in. You will need to replace the text ‘DEFAULT_FONT_FILE’ with your appropriate font resource or the value 0 in order to use the system default font.
CuvoFeedbackManager.init(
this, //application context
APIKEY_VALUE, //apiKey
ORG_ID_VALUE, //orgId
PROD_ID_VALUE, //prodId
PRODUCT_VERSION_VALUE, //prodVersion
"en", //langCode
object : CuvoFeedbackInitCallback { //callback to handle init complete success and error
override fun onSuccess() {
// Handle success
Log.i(TAG, "CuvoFeedbackManager initialized successfully")
}
override fun onError(message: String) {
// Handle Error
Log.e(TAG, "${message}")
}
},
)
Use the CuvoFeedbackInitCallback.onSuccess() to handle any action the needs to happen when init completes.
Use the CuvoFeedbackInitCallback.onError() to handle any errors during init call.
Additonal APIs
You can use the following methods to control the chat agent UI programatically.
// This method is used to display the feedback button on the relevant screens.
// context: the activity context in which to show the button
Cuvo_Fb_FeedBackInitConfigs.showFeedbackButton(context)
// This method is used to hide or delete the feedback button from recommended screens.
Cuvo_Fb_FeedBackInitConfigs.hideFeedbackButton()
// This method is used to open the feedback window from your custom event
Cuvo_Fb_FeedBackInitConfigs.openFeedbackView()