Turn off programmatic

URGENT!!

Hi, I’m building an application to programmatically turn off the cell phone.

My phone is rooted.

Can you give me an example within Kodular of how I turn off my cell phone?

I’ve already viewed all the threads here in the kodular community and haven’t found the answer.
even this one doesn’t work.

run the command

reboot or adb reboot using the Shell component provided by Kodular.

can you give me an example of what the blocks would look like?
Because I’ve been trying for weeks the most several times and I can’t.

All the answers are in the other thread linked by Rogerio (that was opened by yourself) months ago.

If you try that and don’t get it you must come with a specific problem that you got,showing your blocks and explaining the behavior expected x the one you got while following those tips. Just say “nothing worked” is not enough to help you to find where the problem is

1 Like

i tried all these codes in shell: reboot, adb reboot, reboot -p, reboot --poweroff, halt, poweroff, echo o > /proc/sysrq-trigger for shutdown
echo b > /proc/sysrq-trigger for reboot.

All are giving the same error: WRITE_EXTERNAL_STORAGE

see the attachment, am I assembling the blocks correctly?

My phone is rooted and I am accepting the permission.



Capturar111

Are you choosing allow / permitir?
You are testing in apk or companion?

Did you do as suggested in the screenshot and allowed the permission trough the app settings?

yes, I allowed all permissions.

I’m testing on apk, downloading the app and installing it on my phone.

can you make a template of a direct shutdown application and send it to me for me to download and install?

???

yes, i will show you.

anexo


Yeah, that is strange. Did you try it in another phone? Specially a not rooted?
If not, send the apk here so I can test it.

I just tested it on another phone.
the error persists.

I don’t know what the problem is with the commands.

Would it be possible to show me how to assemble the blocks correctly?

Please, does anyone have a terminal ready application made in kodular?

LINUX command.

I’m on android 11, rooted phone.
it has to work with superuser for commands to turn off or restart the cell phone.

See this extension:

http://kio4.com/appinventor/278_extension_shell.htm

It might work with sudo commands on a rooted phone…

I’ll try, thanks for now!

Is not working.

Whenever I put the command (su) to give superuser permission to root to run the command (reboot) to restart the phone, the Kodular app freezes, something is missing.