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

Android GCM Action Buttons lack of documentation #884

Closed
ebarault opened this issue May 13, 2016 · 6 comments
Closed

Android GCM Action Buttons lack of documentation #884

ebarault opened this issue May 13, 2016 · 6 comments
Labels

Comments

@ebarault
Copy link

ebarault commented May 13, 2016

hi,
this is more of some questions/remarks on the docs:

In PAYLOAD.md/android/action buttons
The docs refer to callbacks attached to an app object, just like

message.addData('actions', [
    { "icon": "emailGuests", "title": "EMAIL GUESTS", "callback": "app.emailGuests", "foreground": true},
    { "icon": "snooze", "title": "SNOOZE", "callback": "app.snooze", "foreground": false},
]);

To what app object are you referring to? where should it be declared, attached to what root object? I'm in the context of an ionic app. And I only could make it work using the window object like this:

excerpt of the notification

message.addData('actions', [
    { "icon": "emailGuests", "title": "EMAIL GUESTS", "callback": "emailGuests", "foreground": true},
    { "icon": "snooze", "title": "SNOOZE", "callback": "snooze", "foreground": false},
]);

excerpt of app code where declaring the callbacks

window.emailGuests = function() {
    // do something
}

window.snooze = function() {
    // do something
}

a complete example including app code would be much appreciated i guess, as i see some posts of people stuck in the middle with this, including

here
there

@macdonst macdonst added the docs label May 14, 2016
@macdonst
Copy link
Member

@ebarault

  1. I don't think I have app.myCallback anywhere in the docs so I'm not sure where that needs to be cleared up. If that was the function to be called on a button press then there has to be an object app which has a function myCallback.
  2. Yeah, it's probably not a great idea to call code that is not loaded in your app.

Where do you see lots of people struggling with this? I'd love to be able to answer their questions.

@ebarault
Copy link
Author

ebarault commented May 14, 2016

@macdonst macdonst: thanks for answering, i updated the issue

@sumeeranalabs
Copy link

call back function not working ,please any one help me out about this issue.

@prafull-agarwal
Copy link

Hi Guys

I am also using this plugin with my push notification having actions buttons with actions to be performed in background without open my app.

So this works fine in iOS but on Android it works only when i set foreground true but when i set to foreground false for android its action not working.

So let me know what thing i am doing wrong or its not support this for Android?

@ronaiza-cardoso
Copy link

ronaiza-cardoso commented Feb 3, 2017

please, someone could help me on this? #1569

@lock
Copy link

lock bot commented Jun 4, 2018

This thread has been automatically locked.

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

No branches or pull requests

5 participants