caffeinalab / ti.goosh

GCM/FCM module for Titanium.
MIT License
52 stars 34 forks source link

Is there anyway to detect if a user clicked the notification in the tray? #98

Closed mark22 closed 6 years ago

mark22 commented 6 years ago

I'm looking all over and don't see this anywhere?

It seems either you run a callback on all push notifications or don't. Theres no way to determine if a user actually clicked the notification (hence wants the app to do something)

Isn't this a core functionality of push notifications or have others come up with solutions around this?

Thanks!

Sofianio commented 6 years ago

If you read the Documentation you'll find:

inBackground

A boolean value indicating if the notification has come when the app was in background, and the user has explicited clicked on the banner.

inBackground is true if user clicks the notification (wether the app is opened or not)

mark22 commented 6 years ago

@Sofianio Thanks, but it seems inBackground only works if the app is running in the background. If it is not actually running, the notification comes, but if you click on it, inBackground doesn't work (because the app didn't actually get launched from the 'background' I presume...).

This is a difficult nuance as some users will background apps, others will close them. Functionality should be the same in regards to a user clicking a a notification, regardless of where the app actually resides

Sofianio commented 6 years ago

I can't tell you if "inBackground" works when the app is closed because for me the callback isn't called at all ( see issue #55 )

kopiro commented 6 years ago

Hey guys, issue solved :) https://github.com/caffeinalab/ti.goosh/commit/22924ee861ae3e05f6fb2b2710db34521f0a8d4e

mark22 commented 6 years ago

@kopiro

This update works!

Thank you!!