What is the duration of a maintenance window during doze mode?
Asked Answered
M

1

6

I am looking to use the Jobscheduler api to schedule a job when there's connectivity to download a bunch of images from push messages. Since wake locks are disregarded by the os in doze mode and since an fcm message can only wake the device a maximum of 10s, the maintenance window seems like the only way for me to download the images from all the push notifications.

The images will be max 100kb each and a maximum of 50 images at a time. So basically all in all maximum 5mb data usage.

I was wondering if the window during doze mode will be wide enough to allow these downloads.

I have searched across Google and have come across a few loose data details claiming 5 - 10 minutes.

Can anyone please guide me to the correct information.

Thanks and regards.

Mixie answered 16/2, 2017 at 17:16 Comment(8)
I do not believe that this is documented, probably so that Google can tweak the behavior. In my experiments, it did not seem to be as long as 10 minutes.Barbados
Exactly.. even I'm worried about this. Basically my idea is to gather a burst of push messages each with an image set and saving them. Then showing all these at a later time. Now fcm does wake and partially grant my device some time to access the network but i don't know if it's enough. This leaves me with the Jobscheduler and the above dilemma. Can you suggest any other way i can deal with this doze nonsense and still download my 5 mb :-/Mixie
I would advise you to come up with a different plan, one that does not involve 5MB of background data. In the background, download lower-resolution images (say, 10KB apiece) that you use as placeholders for when the app's UI is brought to the foreground. At that point, for the images that the user needs, download the higher-resolution images. This is akin to how Google Maps deals with zoom events: use the images that you have temporarily, then replace them with better images when you can get them.Barbados
These are images to be shown in notifications. These are not in app images unfortunately. I'm making a marketing platform where people can send push messages using a pub/sub model. I'm gonna be charging people for these image deliveries. I can reduce the image size to let's say 50kb max with normal res. If there are more than one subs by a user, he/she can choose to see each individually or together as one. This issue is a corner case of max 50subs and individual setting.Mixie
"These are images to be shown in notifications" -- then they have no business being 100KB in the first place. Notifications are small.Barbados
Thank you for pointing that out sir. I thought only the payload has restrictions. I'll just be sending urls of the images. What according to you would be the correct dimensions (x * y px) and size(kb) then? Are there any guidelines for these?Mixie
Google does not seem to publish guidelines for this.Barbados
Let us continue this discussion in chat.Mixie
M
0

10 minutes

It seems to be documented, now, finally!

‡ If network access is restricted, the app is granted a window of 10 minutes to use the network at the specified interval.

BUT,

You can't count on it to be the same across all the Android devices out there. Of course, the OEM can alter this. The answer would therefore be, a few minutes as no OEM would insensibly put it out to be just a minute or two.

Milne answered 6/9, 2022 at 15:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.