Order push notifications are sent without android.priority, so they are held while the device is in Doze
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 75/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- firebase, php
- Área
- backend-api-design, mobile
Línea de trabajo
El issue apunta al archivo Fleetbase\Support\PushNotification::createFcmMessage(). Comience localizando este método en la base de código. Revise la construcción actual del mensaje y la documentación de Firebase Cloud Messaging (FCM) para la configuración de prioridad en Android. La solución implica agregar un array 'android' con 'priority' => 'high' al payload personalizado. Pruebe enviando una notificación push después del cambio y verifique que llegue rápidamente a un dispositivo en modo Doze.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- PHP
- Estrellas
- 17
- Forks
- 39
- Merge medio
- 1 d 17 min
- PR fusionados (30 d)
- 31
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Issues similares
-
Awaiting Triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
WordPress/two-factor#1008 ·
Los mantenedores suelen responder en 1 día
-
sync-en
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
sync-en
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Перевод устарел
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 22 días