Launch
Simple
To launch ArcPlay.ai experience add the below-mentioned code to onClick
of ArcPlay.ai nudge.
Arcplay.launch(context /* activity context */)
Arcplay.launch
will return a boolean value
true
- ArcPlay.ai experience is successfully launchedfalse
- ArcPlay.ai experience failed to launch. This will be returned in the following casesuser is offline
Arcplay.init
has not been called yetArcplay.init
is still in progressArcplay.init
has returnedonFailure()
Advanced
1. Deeplink Content Page
To directly launch ArcPlay content pages (e.g. opening a game) from your app, add the below-mentioned code to onClick
of ArcPlay.ai nudge.
Arcplay.launch(context, "<contentId>")
Depending on what contentId
you pass, the respective content page will be opened directly for the user. If contentId
is set to null
, the default homepage will open.
Example: If you pass g:d955ecdc-1d12-4d8c-88ee-2b79ec23a431
as the contentId
, the 'Fruit Knife' game will be opened for the user
2. Init & Launch
To launch Arcplay without pre-initialization, you can call the below function (initAndLaunch
) to initialize and launch ArcPlay in one go.
val initConfig = InitConfig(
accountId = "<<accountId provided by Arcplay>>",
userId = "<<userId of your app's user>>"
clientId = "<<clientId of your app instance, this is optional if userID is provided>>"
)
Arcplay.initAndLaunch(this, initConfig, "<contentId>", object : ArcplayInitListener {
override fun onSuccess() {
Log.i("Arcplay", "Init and Launch success")
appendLogInUI("InitAndLaunch success")
}
override fun onFailure(error: ErrorData) {
Log.e("Arcplay", "Init and Launch failed : $error")
appendLogInUI("InitAndLaunch failed : $error")
}
})
Last updated