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

FLUTTER_NOTIFICATION_CLICK doesn't seem to work #186

Open
jeremiahsherrill opened this issue May 31, 2020 · 4 comments
Open

FLUTTER_NOTIFICATION_CLICK doesn't seem to work #186

jeremiahsherrill opened this issue May 31, 2020 · 4 comments

Comments

@jeremiahsherrill
Copy link

jeremiahsherrill commented May 31, 2020

This is what it looks like

   `$optionBuilder = new OptionsBuilder();
    $optionBuilder->setTimeToLive(60*20);
    $notificationBuilder = new PayloadNotificationBuilder();
    $notificationBuilder->setTitle($title);
    $notificationBuilder->setBody($message);
    $notificationBuilder->setClickAction("FLUTTER_NOTIFICATION_CLICK");
    $dataBuilder = new PayloadDataBuilder();
    $option = $optionBuilder->build();
    $notification = $notificationBuilder->build();
    $data = $dataBuilder->build();      
    $downstreamResponse = FCM::sendTo($tokens, $option, $notification, $data);`

when I include $notificationBuilder->setClickAction("FLUTTER_NOTIFICATION_CLICK"); when the message arrives the in the status bar, and you click the message the app doesn't load. When this is missing, the app launches when you click the message

In either case, if the app is open onMessage gets the notification and displays the message on screen, if the app is closed when the message arrives no data is seen by the app. The flutter part of it works fine, if I send a message from firebase console, then my app receives and see everything. But something isn't being sent by laravelFCM and I can't figure out what that is.

@jeremiahsherrill
Copy link
Author

realized I had a bit of it messed up and also noticed that when I created the intent in my android app that I pluralized FLUTTER_NOTIFICATIONS_CLICK

This should be correct from everything I am seeing and through my research

        $optionBuilder = new OptionsBuilder();
        $optionBuilder->setTimeToLive(90*20)->setCollapseKey('type_a')->setPriority('high');
        $notificationBuilder = new PayloadNotificationBuilder();
        $notificationBuilder->setTitle($title);
        $notificationBuilder->setBody($message);
        $notificationBuilder->setSound('default');

        $notificationBuilder->setClickAction('FLUTTER_NOTIFICATIONS_CLICK');
        $dataBuilder = new PayloadDataBuilder();
        $dataBuilder->addData(['click_action'=>'FLUTTER_NOTIFICATIONS_CLICK', 'id' => 1, 'status'=>'done', 'title'=>$title, 'body'=>$message]);
        $option = $optionBuilder->build();
        $notification = $notificationBuilder->build();
        $data = $dataBuilder->build();
        
      
        $downstreamResponse = FCM::sendTo($tokens, $option, $notification, $data);

Yet when the notification opens the app, the onLaunch is never called. When the same data is sent through the google firebase console, the onLaunch fires.

@aldikun17
Copy link

hi afternoon i have a problem with mine. i can see the data is send to the firebase i can see the sends count is incrementing when i use the notification module,

but no notification in come in my application what did i do wrong
image

@jeremiahsherrill
Copy link
Author

I ultimately ended up using curl for this feature, instead of using this.

@taist24
Copy link

taist24 commented Nov 30, 2020

I'm having the same issue. However, using cURL works!

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

No branches or pull requests

3 participants