" through the application at runtime? I am trying to execute an adb input keyevent 5 shell co...">

Do I need to run the shell command "input keyevent <#>" through the application at runtime?

I am trying to execute an adb input keyevent 5 shell command to answer a call through my application at runtime.

If I do this:

 Runtime.getRuntime().exec("input keyevent 5"); 

It seems that this is not being executed (nothing is happening). But when I do this:

 Runtime.getRuntime().exec(new String[] {"su", "-c", "input keyevent 5"}); 

It is expected that the simulation is pressed on the answer button on the screen. It's good.

However, one of the problems is that on some devices that are deployed using Superuser, the team takes some time to get superuser permission. It works great with devices that have Chainfire SuperSU su binary.

My question is: Is it possible to execute this command without root through Java code at runtime?

Thanks in advance!

+4
source share
1 answer

Absolutely not!

This will be an absolute serious security issue and you must take root.

+2
source

All Articles