1

I´d like to control an app with another app. As far as I know apps in background get paused.

Is there any way to send commands/clicks etc to another app by my control app?

Thanks

Wakan
  • 43
  • 3
  • https://stackoverflow.com/questions/3872063/launch-an-application-from-another-application-on-android may help you – Android Player_Shree Aug 08 '17 at 13:12
  • The only way to ask another app to do some job is using Intents, theres no way you can force clicks, you can only ask politely for behaviour with intent.setAction(Intent.ACTION_VIEW) so the system promtps the user a list of apps that informed it that can handle that action and data – marcos E. Aug 08 '17 at 13:13

3 Answers3

1

Not generally. If you wrote both apps, you are welcome to implement your own control IPC mechanism. An accessibility service can do what you want to a limited extent for arbitrary apps, but nobody with any sense will install your accessibility service, given that you can do all sorts of nasty things to the user and so there are security warnings that get raised when the user goes to activate your accessibility service. On rooted devices, there are probably many more options.

CommonsWare
  • 910,778
  • 176
  • 2,215
  • 2,253
  • ahah you write so fast :) I thought I was first to post the service solution. I agree that no one would dl his app, but it is possible he is using for some personal testing purposes. I do things like that alot and never intent to actually publish these things. – Bqin1 Aug 08 '17 at 13:14
1

If you want to send click events to another App, you can achieve it by Broadcast Receiver.

You have to send a broadcast message and the other app must have a receiver to receive the trigger.

you can get more information about broadcast receiver by this link https://developer.android.com/guide/components/broadcasts.html

Bqin1
  • 389
  • 1
  • 6
  • 18
Bhuvanesh BS
  • 11,405
  • 10
  • 36
  • 61
  • Interesting idea, I think it could work, might be overkill and less compact than services, but another solution to the OP's question :) – Bqin1 Aug 08 '17 at 13:20
0

What you are looking for is a service. In a bounded service, Inter process communication is extremely easy, read here.

https://developer.android.com/guide/components/bound-services.html

You simply bound both your apps to a service they can talk to eachother.

Bqin1
  • 389
  • 1
  • 6
  • 18