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

[Android][messaging] No notification heads up #500

Closed
theohdv opened this issue Oct 12, 2017 · 22 comments
Closed

[Android][messaging] No notification heads up #500

theohdv opened this issue Oct 12, 2017 · 22 comments
Labels
Service: Messaging FCM only - ( messaging() ) - do not use for Notifications

Comments

@theohdv
Copy link

theohdv commented Oct 12, 2017

Issue

This is for Android only.
Android notification heads up are never displayed (app killed or in background).
My notifications are directly displayed in the notification tray.
I tried by setting "priority" (normal & high) but nothing changed.

Here the format of my notifications:

"registration_ids" => [],
"notification" => [
        "sound" => "default",
	"title" => "hello",
        "body" => "world"
],
"data" => [
	"key" => "foobar",
	"key2" => "foobar",
]

I would like something like that:

image

Environment

  1. Application Target Platform: Android

  2. Development Operating System: macOS Sierra

  3. React Native version: 0.48.4

  4. RNFirebase Version: 3.0.3

@theohdv theohdv changed the title [Android] No notification banner [Android] No notification heads up Oct 12, 2017
@theohdv theohdv changed the title [Android] No notification heads up [Android][messaging] No notification heads up Oct 12, 2017
@Ehesp
Copy link
Member

Ehesp commented Oct 12, 2017

Could you try to add the show_in_foreground prop, like our tests here:

@Salakar Salakar added the Service: Messaging FCM only - ( messaging() ) - do not use for Notifications label Oct 12, 2017
@theohdv
Copy link
Author

theohdv commented Oct 13, 2017

I tried but it did not change anything. But I think this property is only for localeNotification not for remote one.
And I want the heads up to display when the app is in background or and it has been killed not when the app is in foreground (Remote notification behavior).

@theohdv
Copy link
Author

theohdv commented Oct 13, 2017

I just noticed that this is a duplicate of #357 but i would like to not use the "custom_notification" approach, is there a proper solution now to do that? (if not, can close the issue)

@samueljseay
Copy link

@theohdv as far as I can tell from the code in MessagingService a notification needs to meet 2 conditions to send in foreground. One is from the firebase spec show_in_foreground. The other is that it requires a custom_notification property to be set on the data attribute.

@chrisbianca this seems non-standard, I was wondering, why do we need to provide that attribute? I guess at this point I may as well write my own FirebaseMessagingService?

@chrisbianca
Copy link
Contributor

Thanks for reporting. We're aware of lots of issues with notifications and will be addressing them all as part of the v3.2.0 release stream. Please see #595 for updates.

@michelebombardi
Copy link

@chrisbianca I'm experiencing this issue too. If I delete the notification property completely I'm able to get notification but only if the app is running in foreground or in background. To get the notification when the app is killed the notification property is required but it won't display as an heads up notification. So here there is a loop :) When do you plan to fix that behaviour?

@chrisbianca
Copy link
Contributor

Good news, the long awaited alpha of our messaging and notifications overhaul is now available!!

Check out the release notes here: https://github.com/invertase/react-native-firebase/releases/tag/v4.0.0-alpha.1

If you have any comments and suggestions or want to report an issue, come find us on Discord

@tpucci
Copy link

tpucci commented May 29, 2018

Hi ! Congrats releasing RNFirebase v4!
Still, I experience the same issue as describe here. How do we create a notification show up on Android ?

@maggialejandro
Copy link

maggialejandro commented Jun 1, 2018

I'm facing the same issue.
react-native-firebase 4.2.0
react-native 0.53.3

The notification arrives but it is shown on the tray bar only.

@kevinEsherick
Copy link

kevinEsherick commented Jun 2, 2018

Im having the same problem on iOS. It was working for a time too, now it isn't. When the phone is in use, scheduled notifications only show up in the tray. They show up on lock screen as well if delivered when the phone is off. Notifications from FCM only show up in the tray, not even on lock screen.

@kevinEsherick
Copy link

@maggialejandro @tpucci any luck? This is killing me right now

@maggialejandro
Copy link

@kevinEsherick not yet.
We were using react-native-fcm so it never worked to us so far

This is our FCM payload

$post = [
  'to' => $to,
  'priority' => 'high',
  'content_available' => true,
  'show_in_foreground' => true,
  
  'notification' => array(
    'time_to_live' => 172800,
    "sound" => "default",
    "lights" => true,
    'color' => '#3f78c3',

    'title' => $notification['title'],
    'body'  => $notification['body'],
    
    'priority' => 'high',
    'tag'   => $notification['id'],

    'icon'      => 'ic_notif',
    'image'     => 'ic_launcher',
    'largeIcon' => 'ic_launcher',
    'smallIcon' => 'ic_launcher'
  ),

  'data' => [
    'notificationId' => $notification['notificationId'],
    'title' => $notification['title'],
    'body'  => $notification['body'],
    'iso' => $notification['iso'],
  ],
];

@avinashwigroup
Copy link

Please open this issue. It is still not working.

@mskrzypkowski
Copy link

mskrzypkowski commented Jun 11, 2018

Guys, in my case the issue were notification settings in phone settings -> installed apps -> Custom notification. When I've added android:showOnLockScreen="true" to the root application node in AndroidManifest - notifications started showing up.

-> on iOS notifications are received only on release build. Don't know if Android debug build of app can receive them.

-> Android Studio's Logcat is worth checking - here: https://stackoverflow.com/questions/25610936/enable-logcat-on-release-build-in-android-studio you can see how to access device' logs on release build. Even if nothing shows up - there are some logs worth to check.

-> I have a different problem - notifications showing up only on locked screen. Showing on unlocked screen is indicated by 'floating notifications' setting which have to be turned on by the user. I don't know how to set it up automatically on app install. Anyone knows something about it? 😃

@edwardrowens
Copy link

@whitefox920, I was having problems with this as well but I overlooked this piece of documentation. Follow that and it should work properly.

If you're using the Firebase Admin SDK you also need to set your message priority to be HIGH on Android 25 and lower or send a message to a channel with max importance for Android 26 and higher. See here for more details.

Hope this helps!

@eladglobalbit
Copy link

Someone can share the json that he send? @theohdv @edwardrowens

I send this and this does not work for me
`{
"to" : "phone-token",
"content_available": true,
"notification" : {
"body" : "Body of Your Notification",
"title": "Title of Your Notification",
"content_available" : true,
"priority" : 10,
"sound": "default"
},
"data" : {
"body" : "Body of Your Notification in Data",
"title": "Title of Your Notification in Title",
"key_1" : "Value for key_1",
"key_2" : "Value for key_2",
"android_channel_id": "Hip-chanelId",
"sound": "default"
},
"priority" : 10

}`

@eladglobalbit
Copy link

@theohdv If u can tell how u fixed that issue this will be great!

@ghost
Copy link

ghost commented Apr 24, 2019

The problem still not solved :( What to do?

@avianezbq
Copy link

Hi!
Why is this closed, the problem still happens... (version 5.2.x)

@mi-mazouz
Copy link

I still have the same issue! Why you closed issues not resolved!?

@mikehardy
Copy link
Collaborator

@mi-mazouz using your same words:

You have not opened a new issue following the issue template! Why don't you open a new issue and supply us with the necessary information to help!?

But more nicely, this issue was closed almost 2 years ago. So much has changed. And it requires lots of information about your environment to troubleshoot. Please open a new issue.

@Salakar
Copy link
Member

Salakar commented Jun 1, 2019

The docs are clear on this also in a big yellow warning:

image

Most if not all of the heads-up notification issues I've come across have been related to that, so I'd start there.

Locking this issue.

@invertase invertase locked as resolved and limited conversation to collaborators Jun 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Service: Messaging FCM only - ( messaging() ) - do not use for Notifications
Projects
None yet
Development

No branches or pull requests