android – FCM Notification Delay in Custom ROM like (Xiami,Oppo, Vivo, Realme etc.)-ThrowExceptions

Exception or error:

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 = [];
   ...
}
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *