I want to create an app that will know when user is using the phone(start the screen and close the screen). After a period of time I need to call doSomething()
method.
Question:
1.How can I know when user start using the phone and when he close the screen?
2.Should I use Service or IntentService? Which is better in my case?
You can try something like this using a BroadcastReceiver and a Service:
Your class using The BroadcastReceiver:
And the service: