0

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.

1 Answer 1

0

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()
Sign up to request clarification or add additional context in comments.

1 Comment

when the fuction is executed, android suggest me to install MAGISK. why? without install any app, can do that?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.