[英]How to do some action when any app on Android device is launched?
I want to be able to show "Hello world!" 我希望能够显示“ Hello world!” whenever new application on Android is launched. 每当在Android上启动新应用程序时。
How to do such thing? 怎么做这样的事情?
I know it's possible. 我知道有可能 As example Password protector (http://droidlessons.com/how-to-password-protect-apps-on-android/) shows password screen when another app is launched. 例如,启动另一个应用程序时,密码保护器(http://droidlessons.com/how-to-password-protect-apps-on-android/)显示密码屏幕。
Password protectors either monitor the topmost activity or monitor the logcat output. 密码保护程序要么监视最高级的活动,要么监视logcat的输出。 Neither of these methods tell you when an application is launched, only when the topmost activity changes. 这两种方法都不会告诉您何时启动应用程序,只有当最顶层的活动发生变化时才告诉您。 There isn't any way to properly be told when an activity starts (unless you modify your OS framework for that purpose). 没有任何方法可以正确告知活动何时开始(除非您为此目的修改了OS框架)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.