Auto Update App

Auto Update is a feature that updates an app on a device. Device users must opt in for auto updates, and your app must capture and send user opt-in status to DT. By default, automatic app updates by the Android OS requires an idle device state. App Updates through DT Ignite Services require the same idle device state:

  • Device connected to an unmetered connection (NETWORK_TYPE_UNMETERED)
  • Device is charging
  • Device not actively in use

To implement Auto Update functionality, ensure that your app performs the following tasks:

Check for Auto Update Opt-In

The getIsAutoUpdateEnabled method is an asynchronous method that allows you to determine if a user has already opted in for Auto Update. For this method, DT returns the following values:

User has opted in for Auto Updates.
User has declined Auto Updates.
Opt in has never been set.

For false and null scenarios, the Host App is responsible for surfacing a UI to encourage the device user to opt in for auto updates.

Send Auto Update Options

To automatically update apps, the device user must first opt in for this function. The Host App must collect the opt-in selection and send the opt-in to DT using the setAutoUpdateEnabled method (asynchronous).

binding.checkboxUserOptIn.setOnCheckedChangeListener { _, isAutoUpdateEnabled -
    val bundle = Bundle()
    if (!"null".equals(binding.hostAppPartnerName.text.toString(), true)) {
        bundle.putString(SdkConstants.HOST_APP_PAYMENT_PARTNER_NAME, binding.hostAppPartnerName.text.toString())
    if (!"null".equals(binding.hostAppOperatorToken.text.toString(), true)) {
        bundle.putString(SdkConstants.HOST_APP_OPERATOR_TOKEN_NAME, binding.hostAppOperatorToken.text.toString())



boolean flag that represents the users Auto Update opt-in status. Use one of the following values as there is no default value:
  • If user is opted in, use true.
  • If user is not opted in, or opt-in status uknown, use false.
boolean flag that determines whether to check for the installation source of the app.


If the previous installation source of the app is Google Play, auto update does not continue via the Ignite Services SDK.

You must include one of the following values as there is no default value:
  • To check the previous installation source of the app, use true.
  • To procede without checking the installation source of the app, use false.
string for the MMP tracking URL you want to fire when the app is updated
bundled data for further processing presented as a key-value pair. Use this to specify a variant for a payment partner app or a specific variant for a specific operator.
  • 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 variant of a GameCoin, use the following string:

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


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.

Broadcasts for App Updates

The SDK stores all App Update opt-in data and schedules update jobs for those opted-in.

Broadcast - App Update Job Scheduling

Listen to the jobStatusBroadcastReceiver to track scheduled jobs.

override fun onStart() {

        val intentFilter = IntentFilter().apply {

        registerReceiver(jobStatusBroadcastReceiver, intentFilter)
    override fun onStop() {


    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:

Sent when App Update is successfully scheduled.
Sent when App Update is successfully cancelled.


DT does not broadcast when the App Update job fails to schedule. Instead, the next time the host app initializes the SDK, DT attempts to schedule the update again.

Listen to Broadcast -  App Update Job Completion

Listen to the BroadcastReceiver for installation success or failure of App Update jobs.


Because activities may be killed before receiving a callback, do not define your receiver as an activity in your host app. Instead, define your receiver as an application class to ensure receipt of App Update status.

            object : BroadcastReceiver() {
                override fun onReceive(context: Context?, intent: Intent?) {
                    intent?.let {
                        when (it.action) {
                            IgniteServiceSdk.ACTION_APP_UPDATE_SUCCESS -> Log.d(
                                "Demo App Updated Successful"
                            IgniteServiceSdk.ACTION_APP_UPDATE_FAILED -> Log.d(
                                "Demo App Updated Failed"
                            else -> Log.d(TAG, "Invalid Action")
            IntentFilter().apply {

This broadcast receiver may contain the following actions:

Sent when app has been successfully updated
Sent when app failed to update


Testing: Setting Device Idle State

When testing your Auto Update implementation, the test device state must be in an idle state:

  • The device is connected to an unmetered connection (NETWORK_TYPE_UNMETERED)
  • The device is charging
  • The device is not actively in use

Use the following commands to set a device to the required idle state:

$adb shell dumpsys deviceidle enabled deep								
#C1 (If output is 0 then run C2 command else run C3)

$adb shell dumpsys deviceidle enable deep								
#C2 (Run above command and check it should not be 0 now)

adb shell dumpsys deviceidle tempwhitelist -d 3000000 com.your.packagename		
#C3 (This commands set demo app jobs to run in device idle mode)

adb shell dumpsys deviceidle tempwhitelist								
#C4 (It should show output like "UID=SOME_NUMBER: SOME_TIME - shell")

adb shell dumpsys activity idle-maintenance								
#C5 (Invoke maintenance mode when device is idle, this will start the App Update Job)

Back to Top ⇧