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

Process notifications in background #398

Closed
filoozom opened this issue Dec 4, 2015 · 3 comments
Closed

Process notifications in background #398

filoozom opened this issue Dec 4, 2015 · 3 comments

Comments

@filoozom
Copy link

filoozom commented Dec 4, 2015

I'd like to process some notifications in my app even if the user didn't click on it to open my app.
The .on('notification') works, but I only get the payload when either :

  • The app is opened via a click on the notification
  • The app was already opened and in foreground.

Why doesn't the plugin execute PushPlugin.sendExtras(extras); on every message received (at least on the Android version) ?
Wouldn't it be better to send the payload to the app, show a notification and call a second .on('notification') when the user actually opens the notification ?
That way we could send push-to-sync requests.

Or am I missing something ?

@fredgalvao
Copy link
Collaborator

There's two things involved here:

  • One is that when an app is not running at all on android (was never opened, or was forcedly closed through the launcher or "alt-tab") the event handlers are non-existing, and we still need to find a way to restore them in this scenario so that notification events can fire even if the app is completely dead. See this issue, this one also and this other one, they explain better the situation, and why it's still not available.
  • The other is that we don't have a dedicated event for when a notification is received on the device in general, but only when it's clicked by the user. There is one type of notification hereby called background notifications that gives you the option to skip from receive -> display notification -> run click handler -> trigger 'notification' to receive -> trigger 'notification' but in this case no notification will be shown to the user at all. The topic on splitting the events has been brought up on this PR and on this comment.

You can always give your input on these options or simply +1 them so @macdonst knows what to prioritize.

@filoozom
Copy link
Author

filoozom commented Dec 4, 2015

Thanks for the fast answer! I'll definitely take a look at these issues and PRs.

@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.
Labels
None yet
Development

No branches or pull requests

2 participants