[英]Do I need FCM high priority messages to push changes to Firestore listeners in Doze mode?
I'm using Firestore event listeners https://developers.google.com/android/reference/com/google/firebase/firestore/DocumentReference.html#addSnapshotListener(com.google.firebase.firestore.EventListener%3Ccom.google.firebase.firestore.DocumentSnapshot%3E) to show notifications in NotificationManager. 我正在使用Firestore事件监听器https://developers.google.com/android/reference/com/google/firebase/firestore/DocumentReference.html#addSnapshotListener(com.google.firebase.firestore.EventListener%3Ccom.google.firebase .firestore.DocumentSnapshot%3E)在NotificationManager中显示通知。 But in Doze mode the notifications are delayed for about 10-15 minutes.
但是在打ze模式下,通知会延迟大约10-15分钟。 Is my understanding correct that Firestore uses something like FCM normal priority messages for data synchronizations, causing the listeners to stall?
我的理解是否正确,Firestore使用诸如FCM正常优先级消息之类的内容进行数据同步,从而导致侦听器停顿?
Per my requirements I need to show the notifications as soon as possible (the app is some kind of POS) and 10 minutes is too long. 根据我的要求,我需要尽快显示通知(该应用程序是某种POS),而且10分钟太长了。
I'd like to ask if following approach is feasible: I plan to use Firebase Cloud Functions triggered on changes in Firestore (Google example is for Datastore, is it true for Firestore too?) and send FCM high priority message to client, and then it will show notification. 我想问一下以下方法是否可行:我计划使用在Firestore中发生更改时触发的Firebase Cloud Functions(Google示例适用于Datastore,Firestore也适用吗?)并将FCM高优先级消息发送给客户端,然后它会显示通知。 Is my assumption correct that Firestore listeners on client will be updated then, since the device woke up on the high priority message?
我的假设是正确的,因为设备会在高优先级消息中醒来,然后将更新客户端上的Firestore侦听器?
I plan to defer the FCM messages for about 30 seconds, to process the changes in batch. 我计划将FCM消息延迟大约30秒钟,以批量处理更改。 The listeners will send to Firestore DB the last time when they were activated, and the Firestore Cloud Function will check if the client's listeners were not called for some time (30 secs) and changes exist, then the FCM high priority message will be sent.
监听器将在上一次激活时发送到Firestore DB,并且Firestore Cloud Function将检查是否在一段时间(30秒)内未调用客户端的监听器,并且存在更改,然后将发送FCM高优先级消息。
I'm worried if I'm not "inventing a wheel", as the use case seems to be quite common. 我担心是否不是“发明轮子”,因为用例似乎很常见。 Is there any better solution?
有更好的解决方案吗? For my approach I'll have to keep a table with entries per connected device, which may be large, in general.
对于我的方法,我必须保留一个表,其中包含每个连接的设备的条目,通常可能很大。 And most important that it goes against Firestore "sense" - all Google tutorials say how great it is just to register listeners and get instant updates (and it works smart I agree, at least for UI changes which obviously not important for doze mode, under the black screen) for status bar notifications (when user expects notification by sound etc) I'll have to use FCM push notifications anyway.
最重要的是,它违背了Firestore的“感觉”-所有Google教程都说,注册侦听器并获取即时更新非常棒(我同意,至少在UI更改方面,它很聪明,至少对于休眠模式不重要)黑屏)状态栏通知(当用户期望通过声音等方式通知时)无论如何,我都必须使用FCM推送通知。
If go further, I can add relevant payload to the messages, to receive updates without listeners, and then what the fun is to use listeners at all? 如果走得更远,我可以将相关的有效负载添加到消息中,以在没有侦听器的情况下接收更新,那么使用侦听器有什么乐趣呢? If it is correct then Firestore doesn't seem to be so sweet as it sells, at least for my case, when the Doze mode delays matter...
如果它是正确的,那么至少在我看来,当打ze模式延迟很重要时,Firestore似乎并不像它卖的那么甜蜜……
Please advice, may be somebody already dealed with such use case and Firestore. 请指教,可能有人已经处理过这种用例和Firestore。
Is my understanding correct that Firestore uses something like FCM normal priority messages for data synchronizations, causing the listeners to stall?
我的理解是否正确,Firestore使用诸如FCM正常优先级消息之类的内容进行数据同步,从而导致侦听器停顿?
Firestore does not use FCM for data synchronization. 公司的FireStore 不使用流式细胞仪进行数据同步。 It has its own wire protocol, separate from FCM.
它具有自己的有线协议,与FCM分开。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.