Using LINUX commands in App Inventor. Extension

https://www.php.net/manual/en/function.shell-exec.php

1 Like

I didn't get anything with this command (Firefox, Chrome, Win 7 pro, Galaxy Note8 - Android 9, Nexus5x - Android 8.1). Nothing from curl --version, curl --help etc.
Any clue why?

Probably not installed on your device (it isn't on mine either....)
Check what is with:

ls /system/bin/
1 Like

Yes curl is not there and also some other commands that I'm missing. So what to do?
Does it depend on my adb.exe (I have no clue of that)?

No it is just about the device and what was installed as default by the phone provider.
Worth having a look in some of your other devices?
Need to be rooted to be able to install other packages to the busybox

1 Like

Really useful extension, @Juan_Antonio!

Can we get ping result like this?

KIO4_Terminal.Run
commandLine ping -c 1 google.com

or

ping -c 1 https://www.google.com

1 Like

I meant to say that currently we get result after executing all the command.
Can we get result asynchronously? Like in shell or cmd.

not possible with this extension, this is a workaround:
pingg

1 Like

I am finding on my Android 10 & 11 devices that there is nothing reported back with

ls /system/bin

System command files are there though. If you type:

which ls

you should get back

/system/bin/ls

Thanks Google :wink:

1 Like

Hello i Tried it but nothing happend...must i be rooted to use it ?

yes, as already mentioned

Taifun

Hi,
Is there an option to call this two commands in app inventor when button is clicked?

1) adb shell settings put global private_dns_mode off
2) adb shell settings put global private_dns_specifier some.dns

With this extension you cannot call ADB when you press a button in the application.

It is possible but not easy to set up ADB like that. Instead, I suggest you set up Termux-ADB and use an ActivityStarter to run the command in Termux. You may need to root your device or unlock it's bootloader.

@easrng

Do you have any details on how to access termux using Activity Starter ?

Actually I was wrong, I don't think it will work with ActivityStarter, but it should be fairly simple to make an extension to run things in termux. See this comment for info on how to do it.

Yes, that is where I have been looking. Most things make sense for Activity Starter, but not sure about this one:

  • Third-party program must declare com.termux.permission.RUN_COMMAND permission and it should be granted by user.

Screen1.requestPermission maybe?

How can I install curl 7.58.0 on my phone? Thanks.