Is there an efficient way to call a function in my App whenever an aAtivity is launched(from other apps)? My function would specifically append the name of the app the user just opened into a list in my own app, is there a way to do this without significantly affecting cpu performance or battery life.
Asked
Active
Viewed 28 times
0
-
Your bigger issue is that it is not possible, outside of accessibility services and perhaps a couple of other fringe areas. What you are proposing has significant privacy and security considerations, and Google has been tightening down on access to this sort of information as a result. – CommonsWare Sep 27 '17 at 23:51
-
Could you try to use `BroadcastReceiver`: https://developer.android.com/reference/android/content/BroadcastReceiver.html . **Note: There are some changes in Android O(API level 26)**: https://developer.android.com/guide/components/broadcast-exceptions.html – John Le Sep 28 '17 at 02:03