Interacting with Other Apps

I am developing an app, which is soft dependent on what a user does in another app. E.g. my app may allocate a reward to to a user who shares our image on Instagram.

What can be the best way for my app to verify that the user has done this action. Let's say no API is available for me to verify existence of such a post on Instagram.

a) Does android allow one app to programmatically interact with another. To what extent this depends on what the other app allows, vs certain general features of the platform which are always true irrespective of other app's intention of preventing such interaction?

b) Secondly, if I go the brute force way (provided user permits), can I simulate user actions and launch the other app and interact with it on behalf of the user, much like using the Win32 API and simulating a mouse click or keyboard input?

c) Basically, I just want a screen shot of the user showing me the post has been shared. My simplest goal is to verify that the screenshot is indeed from the other app, and not a static image or a fake app looking like the original?

Any guidance or general advice would be greatly appreciated.



Elite Recognized Moderator
The proper way to do this is to leverage the available APIs. Otherwise you would need some sort of bi-directional trust between your app and the one you want to interact with; definitely doable if you're building both apps, but somewhat less so when you want to tap into an app you don't control.

There are always the hacks by exploiting various accessibility services to see what's being displayed in another app, but apps which abuse those capabilities tend to get banned pretty quickly. And you're definitely not going to be able to perform inputs for the user in another app without drawing Google's attention.

Honestly, just stick with verifying posts via the available APIs. Anything less is pretty shady and likely to upset both users and Google.