Solution 1 :
You can define an accessibility service and call
performGlobalAction(GLOBAL_ACTION_POWER_DIALOG)
This Google codelab will guide you through it:
https://codelabs.developers.google.com/codelabs/developing-android-a11y-service/#0
Problem :
i want to show the power dialog to turn off or restart the device , i found some apps in the play store , it seems they are using accessibility services , but i can’t figure how to do it , anyone have any idea how to implement this ?
this is what i want to show :
Comments
Comment posted by Robert
If you are planning to publish your app on Gogle Play Store you can stop, because Google is banning accessibility usage for such purposes. Not sure when the ban will start but is is announced.