Order push notifications are sent without android.priority, so they are held while the device is in Doze
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 75/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- firebase, php
调研方向
该 issue 指向文件 Fleetbase\Support\PushNotification::createFcmMessage()。首先在代码库中找到此方法。查看当前的消息构建以及 Firebase Cloud Messaging (FCM) 文档中关于 Android 优先级设置的部分。修复涉及在自定义负载中添加一个包含 'priority' => 'high' 的 'android' 数组。通过更改后发送推送通知并验证其在 Doze 模式下的设备上是否及时到达来进行测试。
由索引模型根据 Issue 内容生成。
描述
Summary
Fleetbase\Support\PushNotification::createFcmMessage() builds the FCM message without an Android priority (android.priority). In practice the device treats order pushes (OrderAssigned, OrderDispatched, …) as normal priority, and Android holds normal-priority messages while the device is in Doze. A driver whose phone has been locked and stationary for a while does not get the "order dispatched" push until they unlock, move or charge the phone.
Impact
Drivers miss or get late order notifications. This is the most important push the Navigator app receives. The behaviour is intermittent, so it is easy to misdiagnose:
- With the phone locked for a short time (light Doze), pushes arrive.
- After ~30–60 min locked and stationary (deep Doze), they don't. They show up all at once when the phone is plugged in or unlocked.
Firebase accepts the message in both cases (a message id is returned), so nothing on the server side reports an error.
Versions
Fleetbase v0.7.63 (core-api v1.6.62), laravel-notification-channels/fcm 4.5.0, kreait/firebase-php 7.24.1. Device: Xiaomi phone with HyperOS, app battery setting "No restrictions".
Reproduction
- Log a driver into the Navigator app on an Android phone, then lock the phone and leave it stationary, unplugged, for ~60 min.
- Dispatch an order assigned to that driver. The push is accepted by FCM but is not displayed.
- Plug in the charger or unlock the phone: the push appears.
Controlled test on the same phone, after ~60 min locked and two minutes apart:
- A message identical to
createFcmMessage()'s output was not delivered. - The same message with
android.priority = highwas delivered immediately.
With the phone locked for only ~20 min, both were delivered.
Suggested fix
Set the Android priority explicitly in createFcmMessage():
->custom([
'android' => [
'priority' => 'high',
'notification' => [
'color' => '#4391EA',
'sound' => 'default',
],
'fcm_options' => [
'analytics_label' => 'analytics',
],
],
// apns unchanged
])
High priority is appropriate here: these are user-visible notifications about time-sensitive work, which is the use case FCM documents for high priority.
- 主要语言
- PHP
- 星标
- 17
- 派生
- 39
- 平均合并
- 1 天 17 分钟
- 30 天内合并 PR
- 31
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
Awaiting Triage
难度 1/5 1 小时以内 新手友好度 92/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
WordPress/two-factor#1008 ·
维护者通常 1 天内回复
-
sync-en
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
sync-en
难度 1/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
Перевод устарел
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 22 天内回复