Order push notifications are sent without android.priority, so they are held while the device is in Doze
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 75/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- firebase, php
- Lĩnh vực
- backend-api-design, mobile
Hướng nghiên cứu
Issue này chỉ đến tệp Fleetbase\Support\PushNotification::createFcmMessage(). Hãy bắt đầu bằng cách định vị phương thức này trong codebase. Xem xét cấu trúc tin nhắn hiện tại và tài liệu Firebase Cloud Messaging (FCM) về cài đặt ưu tiên trên Android. Bản sửa lỗi liên quan đến việc thêm một mảng 'android' với 'priority' => 'high' vào payload tùy chỉnh. Kiểm tra bằng cách gửi một thông báo đẩy sau khi thay đổi và xác minh rằng nó đến kịp thời trên thiết bị ở chế độ Doze.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- PHP
- Star
- 17
- Fork
- 39
- Merge trung bình
- 1 ngày 17 phút
- Pull request đã merge (30 ngày)
- 31
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue tương tự
-
Awaiting Triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
WordPress/two-factor#1008 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Перевод устарел
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 22 ngày