I'm currently working on Android (Cordova) App and I'm using OneSignal push notifications. First of all, push notifications were not delivered if I close the app, so I had to add a Cordova plugin to keep my app running in the background :
cordova.plugins.backgroundMode.enable();
The problem is, when I boot my phone I cannot receive push notifications (Because deviceready is not fired). Until I open the app.
Is there a solution to immediately start push notifications service after device boot, like something running in the background ?
My code after deviceready :
cordova.plugins.backgroundMode.enable();
var notificationOpenedCallback = function(jsonData) {
console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
};
window.plugins.OneSignal.init( "my-api-key",
{googleProjectNumber: "7-cant-share-it"},
app.didReceiveRemoteNotificationCallBack);
}
Thanks.