Restart device from Android App


Audience

Hello everybody!

I'm developing an Android app and need to restart the device using the restart code of StageNow. If I read it from the StageNow app it works correctly, but I want to know if there is any way (via Android Intent, for example) to read the restart code from my app and send it to the StageNow to consume it and restart the device.

Now, I can do it in two steps:
1. Open the StageNow app:
val launchIntent = packageManager.getLaunchIntentForPackage(STAGE_NOW_PACKAGE)
if (launchIntent != null) {
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(launchIntent)
finish()
}

2. Scan the reset PDF417 barcode.

There is any way to do it in only one step?

Thanks in advance.

Submitted by jchacon@m-shop.mobi on November 24, 2021 Permalink

Thank you so much Richard! This help me a lot.

The final step on the tutorial fails to me (when send the profile update I receive an internal GENERAL_EXCEPTION_OCCURED error), but making some changes finally I got this working.

Thanks again!

In reply to by Richard Venderbosch