Reputation: 21
I am developing a Flutter application and need to implement a feature that allows the app to be shutdown entire mobile. I am targeting Android 8.1, and I want to know the best approach for achieving this.
Upvotes: 0
Views: 44
Reputation: 162
you maybe try on manifest you define:
<uses-permission android:name="android.permission.REBOOT" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
native code, use platform channel to excute this code:
val process = Runtime.getRuntime().exec(arrayOf("su", "-c", "reboot -p"))
process.waitFor()
Upvotes: 0