Developing with MaestroKit
This guide explains how to develop with the MaestroKit SDK in your Android application.
Instantiating the Base Class
To start using the MaestroKit SDK in your Android project, you will instantiate the Maestro base class.
import com.maestro.sdk.homepage.MainActivity
import com.maestro.sdk.utils.AppConfigManager
class LaunchActivity : FragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val intent = Intent(this, MainActivity::class.java)
AppConfigManager.setConfig(
/**
* the client id
*/
clientId = "63646ca984eb71002f9b2e00",
/**
* This will be used on sign
*/
activationScreenResource = 0
)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
intent.addCategory(Intent.CATEGORY_LEANBACK_LAUNCHER)
intent.addCategory(Intent.CATEGORY_LAUNCHER)
Log.e("Logging", "onCreate: MaestroApp")
startActivity(intent)
finishAffinity()
}
}
Sample App Implementation
Add the necessary configuration and dependencies for MaestroKit SDK.
build.gradle
android {
buildConfigField "String", "CLIENT_ID", ""63646ca984eb71002f9b2e00""
buildFeatures {
viewBinding true
}
}
dependencies {
implementation files("libs/MaestroKit.aar")
}
theme.xml
For andoid tv please provide the splash in 1920 X 1080
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.Maestro" parent="Theme.MaestroSdk">
<item name="android:windowBackground">@drawable/splash</item>
</style>
</resources>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
<uses-feature
android:name="android.software.leanback"
android:required="true" />
<application
android:name="App-name"
android:allowBackup="true"
android:banner="@mipmap/app_banner"
android:icon="@mipmap/mobile_app_icon"
android:label="@string/app_name"
android:roundIcon="@mipmap/mobile_app_icon"
android:supportsRtl="true"
android:theme="@style/Theme.Maestro">
<activity
android:name=".LaunchActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>