If push is coming when app is closed, on clicking the push, app is getting started. But the codes written inside push listener is not getting fired. Working fine in Android. Problem only in iOS.

asked 21 Jan '14, 12:20
vishnurajreubro's gravatar image

vishnurajreubro
4615

Do you use native code or Phonegap/Cordova?

(22 Jan '14, 05:53) shader shader's gravatar image

Phonegap is used

(22 Jan '14, 10:08) vishnurajreubro vishnurajreubro's gravatar image

Please make sure you call onDeviceReady method when your app starts:

pushNotification.onDeviceReady();
permanent link
answered 22 Jan '14, 11:19
shader's gravatar image

shader
3.9k7

Yes i'm calling if after ondeviceready.

var pushNotification; document.addEventListener("deviceready", onCallDeviceReady, false);

function onCallDeviceReady() {

               //alert("Device Ready Now");

registerPushNoti(); // Registration function - > SUCCESS

   listenPush();  // Push Listen Event - > Success only when app is ON.

}

function listenPush() { document.addEventListener('push-notification', function(event) {

//alert("CALL FROM PUSH");
var notification = event.notification;
pushNotification.setApplicationIconBadgeNumber(0);
if(notification.queueId){
    if(!downloadStatus){
        navigator.notification.confirm(locWOReady,function(btnIndex) {
       if(btnIndex==1) {
          app.twirlyThing(app, true); 
            queIdtoUpdate = notification.queueId;
            callWODownPush(notification.queueId);

       }else{
            // do something when Cancel button pressed
            }
  },"");
    }else
    {
       navigator.notification.alert("Download in progress.",null,""); 
    }

}



});

}

permanent link
answered 24 Jan '14, 07:12
vishnurajreubro's gravatar image

vishnurajreubro
4615

No, not onDeviceReady Cordova method. I meant Pushwoosh plugin method onDeviceReady. pushNotification.onDeviceReady(); For example right above registerPushNoti(); function call

(24 Jan '14, 13:04) shader shader's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×352
×1
×1

question asked: 21 Jan '14, 12:20

question was seen: 1,008 times

last updated: 24 Jan '14, 13:04