Finally I was able to get a solution on this so in case anyone running into Similar situation,
We need to utilise the "OnDeviceReady" event to achieve this,
Steps involved in the Solution
Since we are building a remote hybrid app for Salesforce Community, this code will go inside your Community Landing Page,
Add the eventlistener in "Onload" js,
document.addEventListener("deviceready", myDeviceReadyListener, false);
Add the Push registration Logic in the "myDeviceReadyListener" method,
function myDeviceReadyListener() {
var push = PushNotification.init({
"android": { "senderID": "<<<>>>>>" },
"ios": {"alert": "true", "badge": "true", "sound": "true"},
"windows": {}
});
push.on('notification', function(data) {
//This is optional as I am trying to show Push message as an Alert when the //app is in Foreground
if(data.additionalData.foreground)
window.alert(data.title+'\n'+data.message);
//window.alert('insidePushDeviceReady');
if(data.additionalData.coldstart){
//redirecturl will be additional key in your payload to hold //the relative url for redirection
window.open(data.additionalData.redirecturl);
}
});
}
Hope this Helps :)