I am sending gcm push notification from php to cordova app .It works well when user mobile connected with internet. If user mobile is not connected with internet for 4 hours and during that time my server is sending 5 notification .On connecting with internet, user must get 5 missing notification but not getting any of them. I am using phonegap-plugin-push 1.6.4 "PushPlugin" in cordova app Thanks in advance .
PHP Code
$registrationIds = array($to);
$msg = array
(
'notId' => rand(1, 999999),
'message' => $message,
'title' => $title,
'vibrate' => 1,
'sound' => 1
);
$fields = array
(
'registration_ids' => $registrationIds,
'data' => $msg
);
$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
curl_close($ch);
Cordova JS Code
var push = PushNotification.init({"android": {"senderID": appsenderid, "alert": true, "badge": true, "sound": true},
"ios": {"alert": "true", "badge": "true", "sound": "true"}, "windows": {}});
push.on('registration', function (data) {
//alert(data.registrationId);
register_device(data.registrationId);
});