1

I have implemented a hybrid remote app for our Salesforce Community and also activated Push notifications for same.

By default, whenever you gets a push notification, tapping on it opens the app with the default Landing/Start Page as mentioned in the bootConfig.

I am trying to achieve if we can open any specific page other than landing page on Push notification click ? We will have the specific details to be included inside Push payload.

Does anyone have any experience on this.

Thanks for your help :)

1

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 :)

| improve this answer | |
  • Inside Android SenderID value - Please pass your gcm Project ID(Same as entered in BootConfig file) – Ganesh Sawant Jan 31 '17 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.