Will TIME_TICK be broadcast in deep sleep?

Does Android go to deep sleep to broadcast ACTION_TIME_TICK ? From experiments, I do not think so, but I am looking for the final answer.

My experiment involved registering a simple BroadcastReceiver to update a TextView when receiving:

 registerReceiver(new BroadcastReceiver() { int ctr = 0; @Override public void onReceive(Context context, Intent intent) { testView.setText("Time ticks: " + ++ctr); } }, new IntentFilter(Intent.ACTION_TIME_TICK)); 

At 4 ticks, I turned off the screen for about 5 minutes, then turned it on again and read 6 ticks. At 13 ticks, I turned the screen for 10 minutes, then turned it on again, and the number of ticks read 14. It seems to have increased by 1-2 ticks, regardless of how long I leave the phone, so I suspect that it does not broadcast action during deep sleep.

+6
android
source share
2 answers

I looked at the Android code. No, this broadcast will not wake the phone. It uses the AlarmManager.RTC Alarm type to change the broadcast time.

Why do you need to receive a notification literally every minute?

How to set my own alarm using the AlarmManager.RTC_WAKEUP type?

WARNING Running every minute will drain the battery. I suggest doing it less often, like every hour.

Please let me know if this is helpful.

Emmanuel

+9
source share

Best experiment: instead of updating TextView , which you cannot see when the phone is turned off, write to the log using:

 Log.v("Tick","Total ticks: " + ++ctr); 

You can keep track of this in Logcat while your phone is asleep.

+3
source share

All Articles