For DOZE mode test, I am developing a sample GCM App on Android 6.0.
As it's said, In DOZE mode the device would not wakeup for normal priority GCM. I wanted to check this.
As per the documentation (https://developers.google.com/cloud-messaging/concept-options#setting-the-priority-of-a-message)
Normal priority. This is the default priority for message delivery. Normal priority messages won't open network connections on a sleeping device, and their delivery may be delayed to conserve battery. For less time-sensitive messages, such as notifications of new email or other data to sync, choose normal delivery priority.
I tested my app with some server code from this link. https://stackoverflow.com/a/22169411/4242382
The message I send from server is like this:
$msg = array
(
'message' => 'here is a message. message',
'title' => 'This is a title. title',
'subtitle' => 'This is a subtitle. subtitle',
'tickerText' => 'Ticker text here...Ticker text here...Ticker text here',
'vibrate' => 1,
'sound' => 1
);
As you see there is no priority set, so while in DOZE mode I should not get this immediately. But still the device receives the GCM message immediately.
Method of test
- Run the GCM based app
- Induce the DOZE mode by issuing commands from adb shell (link)
$ adb shell dumpsys battery unplug $ adb shell dumpsys deviceidle step
- Send a message from Server (phpfiddle)
Expected behavior : There is no immediate delivery for normal priority GCM Observed behavior : There is an immediate delivery of message
Does the DOZE mode work as per documentation ? I don't see it happening, anybody facing the same?