Closed junshengpierre closed 4 years ago
Hi @junshengpierre , By saying "as a banner", what exactly you mean? What you are describing here is the normal behavior, I think. Can you elaborate more on this / upload a screenshot with the expected behavior? Thanks!
Hi @avishayil,
With inFocusDisplaying(2)
on android, when a notification is received on android, it shows up as an icon on the extreme left corner of the status bar and in the notification shade.
I was trying to make the notifications appear as a banner as well when the app is not in focus like this:
Is this possible with react-native-onesignal? Thank you.
@junshengpierre ~To get a head-up notification like this you need to set the priority
of the notification to 10
. This can be done with the OneSignal create notification REST API call noted below.
https://documentation.onesignal.com/reference#section-delivery~
Update
You must create a notification category / channel to change the display priority of the notification to show the notification as a pop up banner.
See the following page on setting one up and using it.
https://documentation.onesignal.com/docs/android-notification-categories
@jkasten2 Alright, I'll go ahead and do that. Thank you!
Hey @jkasten2 I tried going for your hint by posting to the OneSignal REST API (via RoR) with this params:
params = {"app_id" => ENV["ONE_SIGNAL_APP_ID"],
"headings" => {"en" => title},
"contents" => {"en" => text},
"priority" => 10,
"filters" => [ {"field": "tag", "key": "server_uid", "relation": "=", "value": send_to} ]
}
but it doesn't create a head-up notification, in my tests.
I've been using an Android 6.0 real device, RN 0.38 and react-native-onesignal 1.2.3
.
Is it somewhat related to the config param enableInAppAlertNotification
? Does it have to be set to false
?
@kelset You will need to use the latest 3.0.1 react-native-onesignal SDK. This is required since the feature was added in a recent Android Native SDK update. https://github.com/OneSignal/OneSignal-Android-SDK/releases/tag/3.4.0
So it won't work even in version 2.0?
I'm having same issue, i set priority to high as well. How did you guys fix this?
@jkasten2 Per your comment here https://github.com/OneSignal/OneSignal-Android-SDK/issues/10, it looks like no client-side intervention is needed to raise the notification priority to 10 when the rest API sets it to 10. Is this true for the react-native library as well?
I can't get this to work at the moment with v3.3.2 of the RN libraary. When I examine the notification that is delivered, I see priority: 6
in my react-native client, despite sending priority: 10
via the rest api.
Hi. Same issue here. @cgilboy did you have any luck on this?
@jorbs Unfortunately not. I had to move on to other priorities. Please do ping back if you find a solution!
@cgilboy , Please update to the latest version of the SDK as you're on a very old version. What is the response from the OneSignal REST API?
I was able to get it using a channel.
same issue
@IacoCesar You must create a notification category / channel to change the display priority of the notification to show the notification as a pop up banner. See the following page on setting one up and using it. https://documentation.onesignal.com/docs/android-notification-categories
Hi there, do you guys find a way to make it happen?
Hi,
I am trying to get android notifications to appear as a banner. I have tried inFocusDisplaying(2) but it only showed up in the notification drawer whether the app was in focus or not.
I was able to get iOS notifications to appear as a banner and show up in the notification drawer with
kOSSettingsKeyInFocusDisplayOption: OSNotificationDisplayTypeNotification
regardless of app focus.Is there a config to allow banner notifications on android with RN?
react-native: 0.39.2 react-native-onesignal: 2.0.0 device: Samsung Galaxy S6 Android 6.0.1