简体   繁体   中英

Android development: Access to the activities of other apps

Is it allowed in Android that developers can access the activities of other apps? For example, can my app get triggered when some other app is put from foreground to background or the other way around?

I checked some websites, they mostly talked about how to manage the activity of your own app....I've read someone's article saying there was an API allowing developers to monitor other apps but it was banned after Android5.0.

So please help! I really have no idea if it is possible...Thank you!

Not without access to the framework can you do this. Android was meant to have isolated processes so that this can be avoided. The only thing you can do is launch someone's else's activities should they follow certain criteria. But once it is launched, its under the process of the app you launched, not yours. You should NEVER be able to take control of someone else's process unless they allow you to via some hooks.

One hacky and error-prone ways is to monitor logs and check which activities are launching.. but this is horribly inefficient.

Have a look at my answer here @ https://stackoverflow.com/a/35594313/529691

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM