Broadcast Receiver to detect application start

后端 未结 2 1809
耶瑟儿~
耶瑟儿~ 2020-11-28 07:38

I want to capture the time whenever a user starts any application using my broadcast receiver. is it possible that a broadcast receiver can catch such an event?? if yes , i

2条回答
  •  独厮守ぢ
    2020-11-28 08:13

    You can't get a broadcast when someone starts any other app. The only thing you can do is start a service that polls and periodically checks if new apps have been started (using Reno's code above for example).

    Also if you start this service when the phone starts you have a reasonably good solution.

提交回复
热议问题