Как отобразить подобное диалоговое окно оповещения в Kotlin?

Я добавил коды ниже, но они не сработали.
и
fun requestRootAccess(context: Context): Boolean {
return try {
// Try to get root access
val process = Runtime.getRuntime().exec(arrayOf("su", "-c", "id"))
val os = DataOutputStream(process.outputStream)
// Run a simple root command to test
os.writeBytes("id\n")
os.flush()
// Wait for the process to finish and get the result code
val resultCode = process.waitFor()
os.close()
if (resultCode == 0) {
// Root access granted, show success message
Toast.makeText(context, "granted", Toast.LENGTH_SHORT).show()
true
} else {
// Root access denied, show failure message
Toast.makeText(context, "denied", Toast.LENGTH_SHORT).show()
false
}
} catch (e: IOException) {
e.printStackTrace()
Toast.makeText(context, "error", Toast.LENGTH_SHORT).show()
false
} catch (e: InterruptedException) {
e.printStackTrace()
Toast.makeText(context, "interrupted", Toast.LENGTH_SHORT).show()
false
}
}
Подробнее здесь: https://stackoverflow.com/questions/789 ... -11-and-12