GoogleChromeLabs / web-push-codelab

Other
556 stars 291 forks source link

How to wake up Chrome while in doze state? #62

Closed ahumaro closed 6 years ago

ahumaro commented 6 years ago

Hi!

I am working right now in a project and everything looks fine until the phone enters doze state and notifications can't wake up chrome. For the purpose of my app, a delayed message is not the best approach.

Is there a way to bypass this behavior of doze and chrome or some work around to tell chrome to watch for high priority notifications? I really would like to have the ability to handle this situations without drop my web project and start an Android project, but, if there is no options, I will be making an android app to handle this situation.

Ahumaro.

gauntface commented 6 years ago

Have you tried the urgency header: https://web-push-book.gauntface.com/chapter-04/02-web-push-protocol/#urgency

ahumaro commented 6 years ago

Hi gauntface

I am using the Firebase Cloud Message service to send notifications to my android phone (web page with a service worker in chrome browser).

I am specifying the priority according to this document: https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message

But when the phone is sleeping in doze state, nothing happens until I wake the phone manually.

gauntface commented 6 years ago

@ahumaro in this case this is an issue with FCM and simply may be the case that FCM + Android aren't willing to support this (i.e. it's up to the device to determine the best way to support push vs battery power consumption)