Good day, please help solve the problem:
There is an android daemon written for Android NDK, a simple tcp server. It compiles to .so lib and runs on a device / emulator in daemon mode.
The problem is running.
If I go into the shell:
adb shell And then I write the command:
su -c /dir/daemon 55000 Then everything starts and works, but if I want to do:
adb shell su -c /dir/daemon 55000 That command is executed, but there are no errors and the daemon does not start. I tried various options with installing single and double quotes. If you spam this command several times on the console, then at some point adb locks the console and then the daemon is started. But I would like the result to be after the first attempt.
I need to run this daemon from the Qt application. I do it through QProcess.
I can not understand the reason for this behavior. I climbed in sorts but found nothing sensible.
Demon worker, if you run with your hands, then everything works as it should. I put simple logging into the daemon code right at the entrance to the main function, but we don’t even get there if we try to start from the console via
adb -s <dev_name> shell su -c /dir/daemon <port_number> I tried to generate a shell script inside Qt with a port number and run like this:
adb -s <dev_name> shell sh /dir/script.sh The result is the same, it works only if you first enter the adb shell
Update: I noticed that this problem is present only when we need to start in daemon mode, i.e. either with the daemon () function or with the & at the end of the command. In other cases, everything runs fine even from the console.
adb su(does the sign of the invitation change)? Is it allowed to use root rights inadb(developer settings, root mode). - pavel