How to find a user time spent of any android app

后端 未结 2 877
温柔的废话
温柔的废话 2021-01-07 02:33

Hello I am developing an application where I required to find time spent by user on a certain app like Facebook.

Whenever user has spent x minutes then I want to giv

2条回答
  •  逝去的感伤
    2021-01-07 03:10

    As noted in the question Detect When other Application opened or Launched, you cannot listen for other applications launch signals, but you could sample the list of open applications every so often to check if the app you are looking for is a) running and b) in the foreground.

    You would have to run this application as a service in the background, and I'm pretty sure that it could have devastating implications on the user's phone battery life.

提交回复
热议问题