Quantcast

Aerogear Cordova Push Plugin Android Issue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Aerogear Cordova Push Plugin Android Issue

aamagdi
Hi,

I tried to send a push notification message using the rest sender api as below
{"message": {
  "alert": "test123",
   "user-data": {  
            "somedata":"0",
            "somedata2":"1234"
   }
}}
if the application in the foreground I can read the "user-date" correctly under the payload object on the notification received call back, but if the application wasn't in the foreground the object doesn't contain the payload data ("user-date").

I make a quick review of the plugin code for Android and found that in this part
NotificationMessageHandler.java -> line 77 (Message message = new Message(extras);) you are creating a new message object from the extras variable ;that have all the data; then in
Message.java -> line 46 in the class constructor
    public Message(Bundle extras) {
        this(extras.getString("alert"), extras.getString("sound"),
                Integer.parseInt(extras.getString("badge")),
                extras.getString("aerogear-push-id"),
                extras.getBundle("userData"));
    }
there is not "userData" field under extras, so this will result of ignoring all other payload data.

Could you please check it
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Aerogear Cordova Push Plugin Android Issue

Erik Jan de Wit
Yes this is an error in the plugin, actually 2 errors it's not a bundle (it should be a string) and it's not called userData (but user-data). 

On Tue, Jan 19, 2016 at 12:21 PM, aamagdi <[hidden email]> wrote:
Hi,

I tried to send a push notification message using the rest sender api as
below
{"message": {
  "alert": "test123",
   "user-data": {
            "somedata":"0",
            "somedata2":"1234"
   }
}}
if the application in the foreground I can read the "user-date" correctly
under the payload object on the notification received call back, but if the
application wasn't in the foreground the object doesn't contain the payload
data ("user-date").

I make a quick review of the plugin code for Android and found that in this
part
NotificationMessageHandler.java -> line 77 (Message message = new
Message(extras);) you are creating a new message object from the extras
variable ;that have all the data; then in
Message.java -> line 46 in the class constructor
    public Message(Bundle extras) {
        this(extras.getString("alert"), extras.getString("sound"),
                Integer.parseInt(extras.getString("badge")),
                extras.getString("aerogear-push-id"),
                *extras.getBundle("userData"));*
    }
there is not "userData" field under extras, so this will result of ignoring
all other payload data.

Could you please check it



--
View this message in context: http://aerogear-users.1116366.n5.nabble.com/Aerogear-Cordova-Push-Plugin-Android-Issue-tp441.html
Sent from the aerogear-users mailing list archive at Nabble.com.
_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users



--
Cheers,
       Erik Jan

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Aerogear Cordova Push Plugin Android Issue

Erik Jan de Wit

On Tue, Jan 19, 2016 at 6:25 PM, Erik Jan de Wit <[hidden email]> wrote:
Yes this is an error in the plugin, actually 2 errors it's not a bundle (it should be a string) and it's not called userData (but user-data). 

On Tue, Jan 19, 2016 at 12:21 PM, aamagdi <[hidden email]> wrote:
Hi,

I tried to send a push notification message using the rest sender api as
below
{"message": {
  "alert": "test123",
   "user-data": {
            "somedata":"0",
            "somedata2":"1234"
   }
}}
if the application in the foreground I can read the "user-date" correctly
under the payload object on the notification received call back, but if the
application wasn't in the foreground the object doesn't contain the payload
data ("user-date").

I make a quick review of the plugin code for Android and found that in this
part
NotificationMessageHandler.java -> line 77 (Message message = new
Message(extras);) you are creating a new message object from the extras
variable ;that have all the data; then in
Message.java -> line 46 in the class constructor
    public Message(Bundle extras) {
        this(extras.getString("alert"), extras.getString("sound"),
                Integer.parseInt(extras.getString("badge")),
                extras.getString("aerogear-push-id"),
                *extras.getBundle("userData"));*
    }
there is not "userData" field under extras, so this will result of ignoring
all other payload data.

Could you please check it



--
View this message in context: http://aerogear-users.1116366.n5.nabble.com/Aerogear-Cordova-Push-Plugin-Android-Issue-tp441.html
Sent from the aerogear-users mailing list archive at Nabble.com.
_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users



--
Cheers,
       Erik Jan



--
Cheers,
       Erik Jan

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Loading...