+ Start a Discussion
Trupti BaroleTrupti Barole 

How to handle PushNotification on Android Hybrid App using Mobile SDK

I am trying to implement Push Notification in Hybrid Android App using Mobile SDK.
Using mobile_sdk.pdf (https://raw.githubusercontent.com/forcedotcom/SalesforceMobileSDK-Shared/master/doc/mobile_sdk.pdf) and using apex trigger Push Notification class (https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_push_notification.htm) , I created apex trigger to send a push notification. And on Client Side, using pushPlugin and com.salesforce.util.push.js and similar plugins., I am able to register but not able to get the "Payload", which I am sending from trigger
But Now I am stuck as , Not able to get the notifications in my connected app.
Please Help.
Thanks in advance!!!
Trupti BaroleTrupti Barole
for reference I am using below code :
var notificationHandlerName = "onNotification" + (Math.round(Math.random()*100000)
                    "senderID": bootconfig.androidPushNotificationClientId,
var registrationSuccess = function(result) {
        console.log("Registration successful " + JSON.stringify(result));

var registrationFail = function(err) {
        console.log("Registration failed " + JSON.stringify(err));
 window[notificationHandlerName] = function(message) {
        console.log("Received notification " + JSON.stringify(message));
        if (message.event == "message" || !Android) {
        console.log("Inside Message.event");

My code flows from above method...
Gaurav KheterpalGaurav Kheterpal
Can you confirm which version of the Mobile SDK you are on (3.1?) and if you see any errors in the logs? Have you tried adding more logs to debug the issue?

If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others and improve the overall quality of Discussion Forums.

Gaurav Kheterpal
Certified Force.com Developer| Salesforce Mobile Evangelist| Developer Forums Moderator| Dreamforce Speaker