android listen for app launch

后端 未结 2 911
抹茶落季
抹茶落季 2020-12-19 07:33

I need to develop a service which listen for every activity start. Must I do something like this?

ActivityManager am = (ActivityManager) getSystemService(Con         


        
2条回答
  •  再見小時候
    2020-12-19 08:10

    As far as I know there is currently no way to listen to an app's launch, Unless it is the first time that it is launching. ACTION_PACKAGE_FIRST_LAUNCH (Broadcast Action: Sent to the installer package of an application when that application is first launched (that is the first time it is moved out of the stopped state).

    So I guess your solution is the best for this right now.

提交回复
热议问题