Determining the current foreground application from a background task or service

后端 未结 13 1428
我寻月下人不归
我寻月下人不归 2020-11-22 02:29

I wish to have one application that runs in the background, which knows when any of the built-in applications (messaging, contacts, etc) is running.

So my questions

13条回答
  •  终归单人心
    2020-11-22 02:45

    The ActivityManager class is the appropriate tool to see which processes are running.

    To run in the background, you typically want to use a Service.

提交回复
热议问题