Setup Native Mini-app

Follow steps below to setup a native android/ios mini-app

Package your mini-app as a library#

Package your mini-app as a library (android .aar or ios .framework)
We have a TODO list that is best practices for packaging your app as a library. This would help reduce conflicts when building host-app & mini-app code together. Please contact us for more info.

Create connector module#

This module is the bridge between your mini-app and Terra system, its purpose is to decouple them.

1. Import Hestia library#

implementation("vn.teko.hestia:hestia-android-native:$version")

A recommendation is to import your mini-app sdk here so host-app do not need to import it explicitly. We also prefer to use implementation import to hide details of mini-app from host-app

2. Implement AndroidNativeAppLauncher interface / IOSAppLauncherProtocol protocol#

import android.app.Application
import android.content.Intent
import vn.teko.hestia.android.model.AppLauncherData
import vn.teko.hestia.android.nativelib.AndroidNativeAppLauncher
class MiniNativeAppLauncher : AndroidNativeAppLauncher {
override suspend fun create(application: Application, launcherData: AppLauncherData): Intent {
// parse AppLauncherData to create your own params
val params = createParams(launcherData)
// you can do extra SDK initialization here
// initialize your Intent with params
return Intent(application, MiniAppActivity::class.java).apply {
putExtra("data", params)
}
}
}

3. Read Auth result from AppLauncherData#

override suspend fun create(application: Application, launcherData: AppLauncherData): Intent {
val idToken = (launcherData.authResult as? IdTokenExchangeAuthResult)?.idToken
...
}

4. Setup params on Terra Dashboard#

Please provide us following data, we will do it for you:

  • The connector module class that implement AndroidNativeAppLauncher
  • Extra data that you want to receive in AppLauncherData

Prepare package repository#

  • Send us your mini-app library file and connector module library file, we will push them to Teko package registry, for other host-app to easily import.
  • You can also upload them to your own package registry, then send us the information including:
    • Artifacts names & version
    • Access guide - in case your repository is private. Something like this