Meteor-Community-Packages / raix-push

DEPRECATED: Push notifications for cordova (ios, android) browser (Chrome, Safari, Firefox)
https://atmospherejs.com/raix/push
MIT License
514 stars 197 forks source link

Startup event now working only in cold mode #265

Open artpolikarpov opened 7 years ago

artpolikarpov commented 7 years ago

Oh, no! I fixed it with contentAvailable:1 in notification object. I think we should somehow document it.

raix commented 7 years ago

I'll gladly take a pr improving documentation,

indesignlatam commented 7 years ago

Hello @artpolikarpov, Where did you added this line in the Push.send(). I added it to

apn: {
    contentAvailable: 1
}

and as

contentAvailable: 1

With no luck.

carpmike commented 7 years ago

I was having the same problem on iOS when starting cold (app is not open or in the background). The startup listener was not getting called. Worked fine for Android from cold, and for both iOS and Android when warm (in the background).

This gave me a clue, then I looked at this section of the phonegap-plugin-push docs and it made it more clear. You have to add content-available: 1 to your Push.send() like:

Meteor.methods({'serverNotification'(title, text) {
    Push.send({
      title,
      text,
      from: 'server',
      badge: 1,
      'content-available': 1,
      query: {}
    });
  }
});
raix commented 7 years ago

@carpmike should it be on default or should it be part of the configuration?

carpmike commented 7 years ago

@raix I think to be consistent with phonegap-plugin-push it should be part of the payload and not configured. Probably best to add something about it to the docs and just link to the explanation in the phonegap-plugin-push docs (I linked to it in the last post).