Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to receive clicks from notification bar #7

Open
byrro opened this issue Feb 25, 2022 · 2 comments
Open

How to receive clicks from notification bar #7

byrro opened this issue Feb 25, 2022 · 2 comments

Comments

@byrro
Copy link

byrro commented Feb 25, 2022

Hey, first thanks so much for the amazing work you've been doing in all these libs for Godot! 👏

One question: do you have a clue on how to capture a message data in the app when the user clicks on it from the notifications bar?

Some context:

When I send push messages remotely and the app is closed or in background, the message goes to the device notifications bar. So far so good.

When the user clicks on this notification, it opens the app, but I'd like to capture this click somehow and react to it. But it doesn't trigger the _on_message_received function.

I tried setting the click_action argument in the message, but then it doesn't even open the app when the message is clicked from the notifications bar. It seems I'd need to set some sort of intent-filter, but after hours I could not figure this out.

@byrro
Copy link
Author

byrro commented Feb 26, 2022

So, I managed to get the data from messages by calling localnotification.get_notification_data() from your other library (godot-local-notification).

I can call this function on _ready, see if there's new message data and act accordingly. But if the app was already opened, but in background, _ready won't be called.

Are you aware of any function which is called when the app is brought to foreground? If not, the alternative I thought was to keep checking new messages in _process.

Thanks!

@Overvault-64
Copy link

Did you manage to get any progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants