> For the complete documentation index, see [llms.txt](https://docs.digitalturbine.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalturbine.com/dt-ignite/sdk-reference/check-for-auto-update-preference.md).

# Check for Auto Update Preference

The `getIsAutoUpdateEnabled` method is an asynchronous method that returns a boolean value representing the device user's preference for automatic updates of the Host App.

{% code title="Kotlin" %}

```kotlin
fun getIsAutoUpdateEnabled(): Boolean?
```

{% endcode %}

For this method, DT returns the following values:

| RESPONSE | DESCRIPTION                                                                                                                                                                           |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `true`   | User has opted in for automatic updates of the Host App.                                                                                                                              |
| `false`  | User has declined automatic app updates of the Host App. The Host App is responsible for surfacing a UI to encourage the device user to opt in for automatic updates of the Host App. |
| `null`   | Auto Update preference not set. The Host App is responsible for surfacing a UI to encourage the device user to opt in for automatic updates of the Host App.                          |

## Example <a href="#h_01k4mzy7b4bk2ajmxcqr5b82t7" id="h_01k4mzy7b4bk2ajmxcqr5b82t7"></a>

{% code title="Kotlin" %}

```kotlin
kotclass MainActivity : AppCompatActivity(), IConnectionCallback {
    lateinit var igniteService: IIgniteService

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        initializeSdk(clientSecret, clientMMPUrl) //clientSecret and MMPUrl are stored somewhere in your app.
        igniteService.connect(this)

        // Call remote function on button click
        findViewById(R.id.userOptInCheckBox).setOnCheckedChangeListener {
            IgniteServiceSdk.setAutoUpdateEnabled(isChecked)
        }

    }

    override fun onConnected() {
        Toast.makeText(applicationContext, "Connected to Ignite Service", Toast.LENGTH_SHORT).show()
    }

    override fun onDisconnected(message: String?) {
        Toast.makeText(applicationContext, "Disconnected from Ignite Service: $message", Toast.LENGTH_SHORT).show()
    }

    override fun onDestroy() {
        super.onDestroy()
        igniteService.disconnect(this)
    }
    
    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 fun initializeSdk(clientSecret: String = CLIENT_SECRET, clientMMPUrl: String) {
        igniteService = IgniteServiceSdk.init(
            applicationContext,
            clientSecret,
            clientMMPUrl
        )

        if (IgniteServiceSdk.getIsAutoUpdateEnabled() == null) {
            Toast.makeText(this, "No user Opt in value for auto update", Toast.LENGTH_LONG).show()
        } else if (IgniteServiceSdk.getIsAutoUpdateEnabled() == true) {
            checkboxUserOptIn.isChecked = true
        }
    }
    
    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")
                }
            }
        }
    }

    companion object {
        private const val clientSecret = "my-client-secret-secretly-stored"
    }
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.digitalturbine.com/dt-ignite/sdk-reference/check-for-auto-update-preference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
