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

Show local notification #665

Closed
piotrros opened this issue May 4, 2020 · 2 comments
Closed

Show local notification #665

piotrros opened this issue May 4, 2020 · 2 comments

Comments

@piotrros
Copy link

piotrros commented May 4, 2020

Hi, I'm struggling to implement Firebase cloud messaging. I send the notifications from PHP script or firebase console.

When app is in the foreground and I send the notification, I'm only getting 'OnMessageReceived' called, but no notification is displayed. As I found out, I have to show it myself. So, I've written simple plugin to show it (as a local notification). It works for Android, but on iOS FCM seems to "consume" the notification, when I trigger it.

UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init];
    content.title = nstitle;
    content.body = nsbody;
    content.subtitle = nssubtitle;
    content.sound = [UNNotificationSound defaultSound];

    // Deliver the notification in five seconds.
    UNTimeIntervalNotificationTrigger* trigger = [UNTimeIntervalNotificationTrigger
                triggerWithTimeInterval:1 repeats:NO];
    UNNotificationRequest* request = [UNNotificationRequest requestWithIdentifier:@"Not"
                content:content trigger:trigger];

    // Schedule the notification.
    UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
    [center addNotificationRequest:request withCompletionHandler:nil];

FCM: Received notification from notification center

So, I can't display it anyway. What's the workaround for this behaviour?

@google-oss-bot
Copy link

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@chkuang-g chkuang-g assigned chkuang-g and alexames and unassigned chkuang-g May 27, 2020
@chkuang-g
Copy link
Contributor

Thank you for the information.
Seems to similar to firebase/firebase-unity-sdk#377
We'll get back to you once we understand the nature of this issue.

@chkuang-g chkuang-g reopened this Jul 24, 2020
@firebase firebase locked and limited conversation to collaborators May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants