strongloop/loopback-component-push

Notification model not working as in the examples. data parameter required

Closed this issue · 4 comments

I've been testing push notifications for GCM following the examples at https://github.com/strongloop/loopback-component-push/tree/master/example/server-2.0. Although the notification was arriving to the mobile phone the message I got from the Bundle.extras was:

Bundle[{android.support.content.wakelockid=9, collapse_key=do_not_collapse, from=212428590570}]

So the actual message I'm sending is not arriving.I'm assuming that the alert parameter is supposed to be parsed from the mobile clients, so received in the push notification. Here the Notification object:

      var Notification = Test.app.models.notification;
      var note = new Notification({
        expirationInterval: 3600, // Expires 1 hour from now.
        //badge: 2,
        sound: 'ping.aiff',
        alert: message
      });

So I changed it for this and it worked

      var note = new Notification({
        expirationInterval: 3600, // Expires 1 hour from now.
        //badge: 2,
        sound: 'ping.aiff',
        alert: message,
        message : message
      });

Actually any other parameter added to the Notification object will arrive.
Is alert doing what is supposed to? Or should the documentation be updated to reflect that at least the "message" parameter is required. Probably in order to clarify the example at https://github.com/strongloop/loopback-component-push/tree/master/example/server-2.0 should add some other parameters so who reads it understand that additional data can be sent.

@crandmck Can you verify if the docs reflect what @javierfdr is asking?

I think @javierfdr is specifically asking about the example app, which would be your bailiwick, @superkhau :-)

But anyway, the Push Notification docs have:

var note = new Notification({
        expirationInterval: 3600, // Expires 1 hour from now.
        badge: badge++,
        sound: 'ping.aiff',
        alert: '\uD83D\uDCE7 \u2709 ' + 'Hello',
        messageFrom: 'Ray'
      });

So I'm not clear if I should change messageFrom property to message in that example?... Is it true that message is required?

I think @javierfdr is specifically asking about the example app, which would be your bailiwick, @superkhau :-)

I think its a bit of both.

  1. We need to confirm if the message parameter is required and then reflect it in the docs
  2. We need to update the example to add some other parameters and explain additional data can be sent

@raymondfeng Can you confirm if number 1 is required?

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.