Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Android 5.1: configured push icon is sometimes not taken into account #747

Closed
jakub-g opened this issue Mar 23, 2016 · 8 comments
Closed

Comments

@jakub-g
Copy link
Contributor

jakub-g commented Mar 23, 2016

Expected Behaviour & Sample Code that illustrates the problem

When I configure push icon in frontend, I expect it to be displayed next to my notif, even when there's no icon configured in notif payload:

_pushPlugin = window.PushNotification.init({
  android: {
    iconColor: "blue",
    icon: "push_notification_icon", // this points to a PNG in my resources
    //    senderID: GCM_SENDER_ID,
    //    forceShow: false
  }
});

Actual Behaviour

Depending on exact payload, sometimes the icon is not displayed.

Platform and Version

Android 5.1

(Android) What device vendor

Motorola MotoG3

Cordova CLI version and cordova platform version

cordova --version
> 6.0.0
cordova platform version android
> 4.1.1

Plugin version

cordova plugin version | grep phonegap-plugin-push
> 1.6.0

Sample Push Data Payload

Icon displayed (case 1a on picture)

var message = new gcm.Message({
    notification: {}
});
message.addData({
    customField: 'my custom field',
    alert: 'ALERT'
});

notifs_depending_on_gcm_payload

Icon not displayed (case 3 on picture)

var message = new gcm.Message({
    notification: {
        title: "TITLE",
        body: "BODY"
    }
});
message.addData({
    customField: 'my custom field',
    alert: 'ALERT'
});
@macdonst
Copy link
Member

@jakub-g Yeah, the problem is when you add the notification property to the gcm.Message object with a title and body the OS takes over. Once the OS takes over the plugin never gets called. It's on my list to look into but for now I suggest not populating the notification object. That's why all of my sample node-gcm scripts use the data object only.

@luco
Copy link

luco commented Mar 28, 2016

+1 on this. Getting the same here.

@macdonst
Copy link
Member

@luco yeah, I know guys. For now don't use the notification section in the push payload. Put everything in the data section. That's why I've documented it that way in all the examples.

@jakub-g
Copy link
Contributor Author

jakub-g commented Mar 28, 2016

Not a big issue for me, I just opened the report for reference. Thanks for
quick response.

On Monday, 28 March 2016, Simon MacDonald [email protected] wrote:

@luco https://github.com/luco yeah, I know guys. For now don't use the
notification section in the push payload. Put everything in the data
section. That's why I've documented it that way in all the examples.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#747 (comment)

@amritk
Copy link

amritk commented Apr 5, 2016

+1

@gustavocampos
Copy link

+1, maybe it's worth putting this in documentation.

@Gp2mv3
Copy link

Gp2mv3 commented Aug 23, 2016

I agree, it can be really convenient to put this in the documentation.

@lock
Copy link

lock bot commented Jun 3, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

6 participants