Is there any possibility to throw the key strokes from background service to any running application?
Is there any chance to throw the touch event like this?

mosquitofs wrote:I found a way to start an button on a very easy method... I just Overrided the method onKeyDown and return false
and then did for example this:Using java Syntax Highlighting
KeyEvent kev = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_6); onKeyDown(KeyEvent.KEYCODE_6, kev); Parsed in 0.029 seconds, using GeSHi 1.0.8.4




mandroid wrote:Hi,
Im trying to realize something similar, posted on this thread. My intention was to build a Service, which creates KeyEvents like (DPAD_UP, DPAD_DOWN ...). I have already tried every method, and none of them is working! The Method in this thread is not working or no more available in my SDK (rev 5).

?
mandroid wrote:Hi pskink,
i want to write an app, which can remote control an Android-Device. The remote-aspect is another problem. First of all i want to find out how to inject KeyEvents. Afterwards i guess im' going to try sending keyCodes over USB/Bluetooth or socket to an Android-Device.
Why is it a bad idea to inject KeyEvents? Is it generally a bad idea, or is it bad in the way i am doing it :) ?

if you to call some action which is invoked when you press some key, why not to call it directly ?
key events are propagated to focused view, do you have any control which view is focused or not?
and finally even if you could send key event you could send it only to your app
. Now i'm searching inside the Android reference for a method to get the current focused view. Maybe you know a method to do this?
mandroid wrote:this is why i try to realize it within a service.
mandroid wrote:No i have no control about focused views. The idea, that i need to get a focused view came to me 5 min ago :( . Now i'm searching inside the Android reference for a method to get the current focused view. Maybe you know a method to do this?


)
mandroid wrote:Or, to describe my intend in a simplified way:
I want to press a "UP" on my Computer and get the appropriate reaction (DPAD_UP) on my Android-device (and so on ...)
you could call this a "remote keyboard" for android :)
Furthermore is still don't get it, why it should be a bad idea to inject KeyEvents (sorry :?)

so your app has no gui at all and you want to control other apps by sending key events to them?
from obvious security reasons its impossible
. would you like some service to access it and delete some of your data without your knowledge?
? Yes maybe this would be possible, but its not in my scope. The same refers to a VNC-Server. Of course, it is possible to delete files, install "bad things" on a remote computer, with a VNC. But "usually" this is not the users interest. 
mandroid wrote:from obvious security reasons its impossible
nope, via "android debug bridge" something like this is possible. If you connect to the device-shell over "adb shell" you can inject KeyEvents with the shell-command "input keyevent <keycode>".

Users browsing this forum: No registered users and 7 guests