iOS: Can't process background notification on low battery
KorzeniewskiGrzegorz opened this issue · 0 comments
KorzeniewskiGrzegorz commented
Expected Behaviour
In iOS,background notifications should be processed every time, regardless the low battery (<20%).
Actual Behaviour
On iOS, i am able to process notification in background ONLY if the battery percentage is greater than 20% . If it's less , i only receive the notification, but it is not processed in background (doesn't matter if the device is being charged or not).
Steps to Reproduce
- Battery percentage less than 20% ( doesn't matter if the device is being charged or not).
- Send notification to the device with content_available set to true (FCM legacy API).
- See if notification is processed in background.
- Charge battery more than 20%.
- Send notification.
- The device should process the notification in background.
Platform and Version
iOS 13.5.1
Cordova CLI version and cordova platform version
cordova --version 9.0.0
cordova platform version ios 5.1.1
xcode 11.3
Plugin version
phonegap-plugin-push 2.3.0
Sample Push Data Payload
I am using legacy FCM API :
{
"registration_ids":"aValidToken",
"notification":{
"body":"Some body",
"title":"Some Title",
"vibrate":1,
"sound":"default",
},
"content_available":true,
"data":{
"tipomensaje":"mensajesimple",
},
"priority":"high",
}
Sample Code that illustrates the problem
code that I use to process notification:
` push = PushNotification.init({
android: {},
browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
},
ios: {
alert: 'true',
badge: 'true',
sound: 'true'
},
windows: {}
});
push.on('registration', function(data) {
localStorage.setItem('regId', data.registrationId);
$('#regId').val(data.registrationId);
});
push.on('error', function(e) {
debug("push error = " + e.message);
});
push.on('notification', function(data) {
push.getApplicationIconBadgeNumber(function(count) {
debug('get badge : ' + count);
count++;
push.setApplicationIconBadgeNumber(function() {
debug('set badge : ' + count);
}, function() {
debug('set badge error');
}, count);
}, function() {
debug('get badge error: ' + count);
});
var configuracion = data.additionalData;
if(configuracion.foreground){
$('#centro_mensajes').css('display','block');
$('#aviso_mensaje').text(data.title +"\n"+data.message);
actualizaruids();
}
msg_id = data.additionalData['gcm.message_id'];
push.finish(
() => {
debug('processing of push data is finished for ID=' + msg_id);
},
() => {
debug('something went wrong with push.finish for ID =' + msg_id);
},
msg_id
);
});
Logs taken while reproducing problem
none