3

How to open and perform click on other app packages while my app stays on background.

(Transparent layouts? some service app?) As long as the users sees the clicks generated by my app and performed on other apps. If I open some package like com.game.tetris , I would lose controls to the just launched activity. Or is it so? How my app could inject some extra commands?

Could some sort of service app be made that would launch other apps and send touch commands to it? At least something like this can be done with monkey / monkeyrunner tools, but how to simulate clicks on the screen from the code?

Steps: 1. Open the package com.game.tetris - (Easily done). 2. Click for e.g. 10 times on the coordinates [200, 300} on the screen of the opened app, (How?). 3. When done, pop the own app back on the screen.

user3489718
  • 31
  • 1
  • 2

1 Answers1

3

How to open and perform click on other app packages while my app stays on background.

Fortunately, this is not possible, for obvious security reasons, except perhaps by apps running on rooted devices.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • And If I assume that user has a rooted device, where to begin the implementation? – user3489718 Jul 05 '14 at 15:35
  • @user3489718: I would start by using a search engine to search on `android simulate touch events root`. This, in turn, will turn up lots of interesting links, including [existing Stack Overflow questions](http://stackoverflow.com/questions/14928197/how-to-simulate-touch-from-background-service-with-sendevent-or-other-way), [blog posts](http://www.pocketmagic.net/2012/04/injecting-events-programatically-on-android/), [tutorials](http://forum.xda-developers.com/showthread.php?t=1875094), and so on. – CommonsWare Jul 05 '14 at 15:39