Launch

Simple

To launch ArcPlay.ai experience add the below-mentioned code to onClick of ArcPlay.ai nudge.

Arcplay.launch(context /* activity context */)
Parameter
Data type
Mandatory

context

Activity

Yes

contentId

String

No (details in Advanced section)

Arcplay.launch will return a boolean value

  1. true - ArcPlay.ai experience is successfully launched

  2. false - ArcPlay.ai experience failed to launch. This will be returned in the following cases

    • user is offline

    • Arcplay.init has not been called yet

    • Arcplay.init is still in progress

    • Arcplay.init has returned onFailure()

Advanced

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