Send Auto Update Preference

To automatically update your Host App, the Host App must collect the user's Auto Update preference and send it to DT using the setAutoUpdateEnabled method.

Kotlin
fun setAutoUpdateEnabled(
   autoUpdateEnabled: Boolean,
   checkInstallSource: Boolean? = false,
   mmpUrl: String? = null,
   metadata: Bundle? = null
)
PARAMETER
TYPE
STATUS
DESCRIPTION

autoUpdateEnabled

Boolean

Required

Boolean flag that represents the user's preference for automatic updates of the Host App. Use one of the following values, as there is no default value:

  • If user agrees to automatic updates of the Host App, use true.

  • If user refuses automatic updates of the Host App, use false.

  • If you do not know the user's automatic update preference, use false.

CheckInstallSource

Boolean

Optional

Boolean flag that determines whether DT should check for the installation source of the app. If the installation source of the app is Google Play, automatic updates through DTIS SDK are not available.

Include one of the following values, as there is no default value.

  • To check the installation source of the Host App, use true.

  • To proceed without checking the installation source of the Host App, use false.

mmpUrl

String

Optional

MMP tracking URL to be called when the Host App is updated.

metadata

Bundle

Optional

Bundled data for further processing presented as a key-value pair. Use this to specify a variant for a specific operator or for a payment partner app.

You can send any key-value pair in the metadata bundle. However, before sending a key-value pair in the metadata bundle, you must inform DT which APK version you want to associate with this key-value pair.

To install a specific APK version for MyTelCo customers, use the following string:

bundle.putString(SdkConstants.HOST_APP_OPERATOR_TOKEN_NAME, "MyTelCo")

To install a specific APK version that uses a specific payment partner (GameCoin), use the following string:

bundle.putString(SdkConstants.HOST_APP_PAYMENT_PARTNER_NAME, "GameCoin")

Tracking Auto Updates

Ignite stores the user preferences for Auto Update and schedules update jobs for those who opted in.

Broadcast for Auto Update Job Scheduling

To track scheduled jobs, listen to the jobStatusBroadcastReceiver.

Kotlin
override fun onStart() {
        super.onStart()

        val intentFilter = IntentFilter().apply {
            addAction(IgniteServiceSdk.ACTION_APP_UPDATE_JOB_SCHEDULED)
            addAction(IgniteServiceSdk.ACTION_APP_UPDATE_JOB_CANCELLED)
        }

        registerReceiver(jobStatusBroadcastReceiver, intentFilter)
    }
    
    override fun onStop() {
        super.onStop()

        unregisterReceiver(jobStatusBroadcastReceiver)
    }

    private val jobStatusBroadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() {
        override fun onReceive(context: Context?, intent: Intent) {
            when (intent.action) {
                IgniteServiceSdk.ACTION_APP_UPDATE_JOB_SCHEDULED -> {
                    toast("App Update Job Scheduled.")
                }
                IgniteServiceSdk.ACTION_APP_UPDATE_JOB_CANCELLED -> {
                    toast("App Update Job Cancelled.")
                }
                else -> {
                    println("$TAG Unknown Broadcast Action")
                }
            }
        }
    }

This broadcast receiver may contain the following actions:

ACTION
DESCRIPTION

ACTION_APP_UPDATE_JOB_SCHEDULED

Update is available, and a job to install the update is scheduled. DT does not broadcast when the Auto Update job fails to schedule. Instead, the next time the Host App initializes the SDK, DT attempts to schedule the update again.

ACTION_APP_UPDATE_JOB_CANCELLED

Scheduled update job has been cancelled.

Broadcast for Auto Update Job Completion

To track the installation of scheduled auto updates, listen to the BroadcastReceiver.

circle-info

Because tasks may be cancelled before receiving a broadcast, do not define your receiver as an activity in your Host App. Instead, define your receiver as an application class to ensure receipt of Auto Update statuses.

This broadcast receiver may contain the following actions:

ACTION
DESCRIPTION

ACTION_APP_UPDATE_SUCCESS

Installation of the updated Host App completed successfully.

ACTION_APP_UPDATE_FAILED

Installation of the updated Host App failed.

Examples

Last updated