How can I get notification if the screen is locked and my app is not running? [closed]

StackOverflow https://stackoverflow.com/questions/19412134

  •  01-07-2022
  •  | 
  •  

سؤال

I am implementing a tracking app. Where I need to find out how much time a user is using a different app like facebook or twitter. I can track the time but my main problem is that time keeps adding, if the screen is locked. I want to find out how much time a user are actually using facebook or twitter. I have implemented a Broadcast Receiver in my app to receive the broadcast when the screen is locked. It worked fine, and the broadcast receiver receives screen lock call when my app is running. But my app does not receive any notification when my app is not running. How can I solve this problem?

هل كانت مفيدة؟

المحلول

You should implement a Service!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top