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

Android: action buttons not showing in notification if icon is not specified #584

Closed
jopelkey opened this issue Feb 6, 2016 · 4 comments

Comments

@jopelkey
Copy link

jopelkey commented Feb 6, 2016

I am trying to get action buttons working on the push using the version 1.5.3 of the push plugin on Android and can't seem to get the buttons to show. I am getting the push notification - just no buttons.

My config as passed to the init call just has a senderID:
config = {
"android" : {
"senderID": "111111111111",
}
}

I am using node-gcm to send the push. The message that is getting sent from node-gcm looks like:
{
"params": {
"data": {
"actions": [
{
"callback": "window.rejectVerification",
"title": "Reject"
},
{
"callback": "window.acceptVerification",
"title": "Accept"
}
],
"message": "My message",
"notId": 1454718550,
"title": "My Title"
},
"delayWhileIdle": false,
"priority": "high",
"timeToLive": 300
}
}

output from: adb logcat | grep PushPlugin

(Why do I only see the logging for one of the actions and not the second one? Wondering if there is a failure at this point that is causing the actions to not get set up properly...)

V/PushPlugin( 6057): execute: action=init
V/PushPlugin( 6057): execute: data=[{"android":{"senderID":"947243259468"}}]
V/PushPlugin( 6057): execute: jo={"senderID":"947243259468"}
V/PushPlugin( 6057): execute: senderID=947243259468
V/PushPlugin( 6057): onRegistered: {"registrationId":"myId here"}
D/PushPlugin( 6057): no icon option
D/PushPlugin( 6057): no iconColor option
D/PushPlugin_GCMIntentService( 6057): onMessage - from: 947243259468
D/PushPlugin_GCMIntentService( 6057): normalize extras
D/PushPlugin_GCMIntentService( 6057): key = actions
D/PushPlugin_GCMIntentService( 6057): replace key actions with actions
D/PushPlugin_GCMIntentService( 6057): key = notId
D/PushPlugin_GCMIntentService( 6057): replace key notId with notId
D/PushPlugin_GCMIntentService( 6057): key = title
D/PushPlugin_GCMIntentService( 6057): replace key title with title
D/PushPlugin_GCMIntentService( 6057): key = message
D/PushPlugin_GCMIntentService( 6057): replace key message with message
D/PushPlugin_GCMIntentService( 6057): key = collapse_key
D/PushPlugin_GCMIntentService( 6057): replace key collapse_key with collapse_key
D/PushPlugin_GCMIntentService( 6057): background
D/PushPlugin_GCMIntentService( 6057): message =[My message]
D/PushPlugin_GCMIntentService( 6057): title =[My Title]
D/PushPlugin_GCMIntentService( 6057): contentAvailable =[null]
D/PushPlugin_GCMIntentService( 6057): create notification
D/PushPlugin_GCMIntentService( 6057): stored icon=android_push
D/PushPlugin_GCMIntentService( 6057): stored iconColor=#53bbd4
D/PushPlugin_GCMIntentService( 6057): stored sound=true
D/PushPlugin_GCMIntentService( 6057): stored vibrate=true
D/PushPlugin_GCMIntentService( 6057): using icon from plugin options
D/PushPlugin_GCMIntentService( 6057): no icon resource found - using application icon
D/PushPlugin_GCMIntentService( 6057): create actions
D/PushPlugin_GCMIntentService( 6057): adding action
D/PushPlugin_GCMIntentService( 6057): adding callback = window.rejectVerification

I am using:

  • cordova cli: 6.0.0
  • cordova-android: 5.1.0
  • phonegap-plugin-push: 1.5.3
  • Samsung S5/Verizon running Android 5.0
@jopelkey jopelkey changed the title Android: action buttons not showing in notification Android: action buttons not showing in notification if icon is not specified Feb 6, 2016
@jopelkey
Copy link
Author

jopelkey commented Feb 6, 2016

I added some debugging to the plugin and realized that sending actions without an icon specified does not work. i.e. when sending these actions

[{
"callback": "window.rejectVerification",
"title": "Reject"
},
{
"callback": "window.acceptVerification",
"title": "Accept"
}]

adding the 1st callback ends up throwing the following exception:
org.json.JSONException: No value for icon

The current documentation implies that the icon is optional. And indeed if I supply a bogus icon name, then I get buttons.

So - I can work around this for now, but seems like the icon attribute in the actions list should really be optional.

@macdonst macdonst added this to the Release 1.6.0 milestone Feb 7, 2016
@macdonst
Copy link
Member

macdonst commented Feb 7, 2016

@jopelkey you are right, I will fix.

macdonst added a commit that referenced this issue Feb 7, 2016
@macdonst
Copy link
Member

macdonst commented Feb 7, 2016

@jopelkey thanks for the detailed but report. The issue has been fixed and will be in the 1.6.0 release.

@lock
Copy link

lock bot commented Jun 5, 2018

This thread has been automatically locked.

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

No branches or pull requests

2 participants