Restart Your Phone

Asked

Viewed 415 times

-1

Any code hint to restart your phone after an action?

Example: After performing the backup, I need the phone to restart to finish the settings.

  • 1

    If I’m not mistaken, it’s not possible for an app to do this, it requires high privileges (root), which will drastically decrease the users of your app.

  • See this question in the Soen http://stackoverflow.com/questions/32984849/restart-android-device-programmatically

  • Do you think it is more feasible to put an alert message then? that the change will only take effect after the reset ?

  • Does the system or your application need to restart? If it is the system, why does the system need to restart? You can only restart the system if your application is installed in the folder /system/app (which is unfeasible, unless you have root access to the user’s device before they use the app) and with reboot permission. I find a notification something very volatile for something that seems to be important because the user can ignore it and the reboot can take a long time to happen

  • Chiavone, is that I created a Boadcast Receiver to reschedule all alarms when restarted the phone, reading a table of the database not to lose them. Restoring the backup, would restart the phone to reschedule all and make the application run properly. however, I put a Alertdialog notifying after the restore, that the system should be restarted

  • Why not use another message to reschedule, besides the reboot message? After restoration, you could send a message that you yourself capture. This would allow the receiver instance to be the same, just register it to listen to other Broadcast Message.

Show 1 more comment

1 answer

0

Put that permit on your manifesto

<permission android:name="android.permission.REBOOT"/>

Rotate that code

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
pm.reboot(null);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.