Launch my application when a user opens a certain application - Android

Viewed 102

Is there a way to open my application when a user opens a certain application?

For instance, I want to launch my application's floating button as soon as the user opens Instagram. Or even better is they open the "story" camera?

This is different from inexplicit intent, since, I don't have a way of interacting with Instagram, but is it still possible?

Do I need to check with the system to see which application are currently open or is there another way of doing this?

1 Answers

As NomadMaker says, in general this is difficult to do because it would be a security issue. In fact, an issue like this was published as the Strandhogg vulnerability. That said, some apps (like LastPass) use/abuse the AccessibilityService API to get this information. This would be an OK way to do this if you're making an app for yourself, but is discouraged if you plan to distribute the app.

Related