how to use activityResultContract to get the result if user back from wifi setting kotlin

31 Views Asked by At

how to use activityResultContract to get the result in boolean (true/false) if the user back from wifi setting in kotlin

if user is back from wifi setting, then just return true if user is back from for example lock screen, then return false

i have use activity contract

class WifiSettingChangeContract : ActivityResultContract<Unit?, Boolean>() {

    override fun createIntent(context: Context, input: Unit?): Intent {
        return Intent(Settings.ACTION_WIFI_SETTINGS)
    }

    override fun parseResult(resultCode: Int, intent: Intent?): Boolean {

        return resultCode == Activity.RESULT_OK
    }
}

but it always return false

any help regarding this?

0

There are 0 best solutions below