Manage Mini-apps

Initialization#

val hestia = TerraHestia.getInstance(terraApp)

Usage#

Fetching mini-app list#

coroutineScope.launch {
val result = hestia.fetchApplicationList()
if (result.isSuccess()) {
val appList = result.get()
// display app list
} else {
// handle error
}
}

Fetching detail of a mini-app#

coroutineScope.launch {
val result = hestia.fetchApplicationManifest(
appCode = "mini_app_code",
appType = AppType.NativeAndroid // please change it to according appType of this mini-app
)
if (result.isSuccess()) {
val appDetail = result.get()
// handle success result
} else {
// handle error
}
}

Start a mini-app#

hestia.startApp(
appCode = "mini_app_code",
appType = AppType.NativeAndroid, // please change it to according appType of this mini-app
extraConfig = mapfOf<String, String>(), // optional
callback = object : HestiaCallback { // optional
override fun onSuccess() {
// handle success
}
override fun onError(error: HestiaError) {
// handle error
}
}
)

Note:

  • For using a Native mini-app, you must add dependency of this mini-app into build.gradle file.
  • For using a React Native mini-app, you must add some dependencies for React Native (required by that mini-app) into build.gradle file.