0

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.

Anirudh
  • 2,648
  • 2
  • 13
  • 16
  • 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

0 Answers0