1

Guys In my application notification is the prior thing.

The issue is about Custom ROM (i think all Chinese devices those use default battery saver). some time notification delay by 1-2 hr or not getting notification.

Cases

  • App in kill mode
  • in some device App in background
  • when screen off.

  • Some Case When we tap on app icon > app opened and at that time all pending notification popup

  • etc

Those are some standard cases when a notification is delayed or not received.

Can those things be handled programmatically?

Update

-Below is php function for sending a notification to Android

function sendAndroidNotification($to, $dataPayLoad, $entity, $is_topic)
{
    ...
    $payload = [];
    $payload['data'] = $dataPayLoad;
    if ($is_topic) {
        $payload['to'] = '/topics/' . $to;
    } else {
        $payload['to'] = $to;
    }
    $payload['android'] = [];
    $payload['android']['ttl'] = "30s";
    $payload['android']['priority'] = "HIGH";
    $processedPayload = str_replace("'", "'" . '"' . "'" . '"' . "'", json_encode($payload, JSON_UNESCAPED_SLASHES));
    $output = [];
   ...
}
Vishal Patel
  • 2,931
  • 3
  • 24
  • 60
  • Share the notifications you send please. are those data message? what's the TTL? priority? show us some content so we can help. – Grisgram Feb 24 '20 at 12:32
  • @Grisgram Question is updated – Vishal Patel Feb 24 '20 at 12:53
  • I am working for a company doing voip communication and we have no issues with high priority messages, not even on those mentioned devices. how does the receiving service on the android side look like? How did you measure that delay? are you trying to show a UI (like a ringing screen)? You need a foreground service for that on Android 10. Can you share your FCM Service onReceive method? But **it is essentia**l that you set up those devices to allow unrestricted background data or they might not be able to receive the notifications. – Grisgram Feb 24 '20 at 13:02
  • allow unrestricted background data settings can be handled programmatically? – Vishal Patel Feb 24 '20 at 13:12
  • Have you put your application in white list from 'Battery Optimization'?? Try that. Refer this: https://stackoverflow.com/questions/32627342/how-to-whitelist-app-in-doze-mode-android-6-0 – Naitik Soni Feb 25 '20 at 05:03
  • battery optimization is now under policy violation so app may reject – Vishal Patel Feb 27 '20 at 06:53

0 Answers0