Jio TV Set Top Box (STB) Integration with Android SDK
Learn how to integrate CleverTap SDK for apps on Jio TV Set Top Box.
Introduction to Jio TV STB
The Jio TV Set Top Box is a device that can transform any conventional TV into a smart TV. It consists of a remote control and a hardware set-top box device connected to a TV and Wi-Fi. The set-top box essentially contains an Android Open Source Project (AOSP) fork. Thus, it can transform a normal TV into a smart TV controlled by a standard remote control.
Develop Apps For Jio TV
Jio TV apps are developed in the same manner as Android apps. Both use a native Java/Kotlin-based Android framework, Android libraries, and tools such as Android Studio to create builds. However, Jio OS does not support some Google APIs, preventing the operation of libraries such as FCM. Furthermore, Jio TV STB apps are deployedΒ through the Jio Store rather than the Play Store.
Integrate CleverTap with Jio TV Apps
As mentioned, Jioβs Operating System (OS) does not support some Google APIs and Libraries. Therefore, we cannot use CleverTap-based push notifications with a Jio TV app. For more information, refer to the Smart TV Feature Matrix.
- Integrate CleverTap SDK in Gradle and Manifest
- Initialize CleverTap SDK in the Application Class
- Use the CleverTapAPI Instance to Run Various Functions
Integrate CleverTap SDK in Gradle and Manifest
This section describes how to integrate CleverTap SDK in Gradle and Manifest files.
Gradle Files
To integrate CleverTap SDK in the Gradle file, add the dependencies below in your application's build.gradle
file:
/* ============ src/build.gradle ========== */
//...
dependencies {
implementation "androidx.core:core-ktx:1.7.0"
implementation "androidx.leanback:leanback:1.0.0"
implementation "androidx.appcompat:appcompat:1.4.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.2"
// google libs
implementation "com.google.android.gms:play-services-location:18.0.0"
implementation "com.google.android.exoplayer:exoplayer:2.15.1"
implementation "com.google.android.material:material:1.4.0"
// 3rd party libs
implementation "com.github.bumptech.glide:glide:4.11.0"
//CLEVERTAP Libs
implementation "com.clevertap.android:clevertap-android-sdk:4.6.6"
}
Manifest File
To integrate CleverTap SDK in the Manifest file, use the following code:
<!-- ============ src/main/AndroidManifest.xml ============ -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- required by clevertap sdk -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- ... -->
<application android:name=".MainApp">
<meta-data android:name="CLEVERTAP_ACCOUNT_ID" android:value="YOUR_ACCOUNT_ID" />
<meta-data android:name="CLEVERTAP_TOKEN" android:value="YOUR_TOKEN" />
<meta-data android:name="CLEVERTAP_REGION" android:value="YOUR_REGION"/>
<!-- ... -->
</application>
</manifest>
Initialize CleverTap SDK in the Application Class
To initialize CleverTap SDK in the Application class, use the following code:
class MainApp : Application() {
var cleverTapAPI: CleverTapAPI? = null
override fun onCreate() {
CleverTapAPI.setDebugLevel(com.clevertap.android.sdk.CleverTapAPI.LogLevel.VERBOSE)
ActivityLifecycleCallback.register(this)
super.onCreate()
cleverTapAPI = CleverTapAPI.getDefaultInstance(applicationContext)
val importance = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) NotificationManager.IMPORTANCE_MAX else 5
CleverTapAPI.createNotificationChannel(applicationContext, "id", "name", "description", importance, true)
}
/*...*/
}
Use the CleverTapAPI Instance to Run Various Functions
You can call the CleverTapAPI
instance to run the following functions:
Send User Profile
To send a user profile to CleverTap, use the following code:
val map = hashMapOf<String,Any>("Name" to "new_tv_user", "Email" to "[email protected]")
cleverTapAPI.onUserLogin(map)
Push Event
For example, let's say you want to record an event called "BUTTON_PRESSED" when a user clicks on a button in the Custom Push. To record this event with the CleverTap SDK, you can use the following code snippet:
cleverTapAPI.pushEvent("BUTTON_PRESSED")
Push Event With Parameters
To push events with parameters to CleverTap, use the following code:
val date = Date().toString()
cleverTapAPI.pushEvent("REMOTE_BUTTON_PRESSED", mapOf("time" to date))
Push Charged Event
To push a Charged event to CleverTap, use the following code:
val charges = hashMapOf<String,Any>("Total Number Of Items" to "4", "Total Amount" to "400")
val items = arrayListOf(hashMapOf<String,Any>("Item name" to "jeans", "Number of Items" to "4", "Item category" to "clothing", "Amount" to "400"))
cleverTapAPI.pushChargedEvent(charges,items)
Add Profile Properties
To add profile properties, use the following code:
cleverTapAPI.addMultiValueForKey("userTVCount","1")
Remove Profile Properties
To remove profile properties, use the following code:
cleverTapAPI.removeValueForKey("userTVCount")
Updated 12 months ago