react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

android push notification on schedule not showing drop down from top

Open ghost opened this issue 8 years ago • 14 comments

I just setup this push notification with on schedule. Is working fine with my app on background but my problem is, there is no notification drop down from top in my home instead the notification just come in without any drop down etc.

notification banners i would say since i am not sure what is the name or term for that and i used drop down instead

using it on android and currently this is my code

handleAppStateChange(appState){ if(appState === 'background'){ PushNotification.localNotificationSchedule({ message: "SUMMER SALE IS ON!", date: new Date(Date.now() + (this.state.seconds * 1000)) // in 60 secs }); } }

componenentDidMount(){ PushNotification.configure({ onNotification: function(notification) { console.log( 'NOTIFICATION:', notification ); }, })

}

and another note is that, my console.log for PushNotification.configure is not showing as well when i receive the notification. Not sure if this is the cause.

ghost avatar Aug 25 '18 06:08 ghost

That's because the priority is set too low. It is currently set to PRIORITY_HIGH, but should be PRIORITY_MAX. https://github.com/zo0r/react-native-push-notification/blob/97084450f90d30a0c6b63efa09f3f6dd3f5f8ea9/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java#L168

senne-af avatar Aug 27 '18 10:08 senne-af

set it to PRIORITY_MAX but i still get the same non banner popup. Not sure why is that happening. I am using the emu of nexus 5X API 26 with android 8.0

ghost avatar Aug 27 '18 10:08 ghost

It might be because the app was already installed and the settings were kept (the user can change the priority in the app settings). Try deleting the app from the emulator and reinstalling it.

Just a side note: You should refrain from changing dependency code, since your changes will be overwritten when you reload your dependencies. Instead you could fork the project or create a pull request to include the change in this library.

senne-af avatar Aug 27 '18 12:08 senne-af

hmm i cleared the data from my emulator and uninstall the app and re run it with react-native run-android and still no pop up banner

ghost avatar Aug 27 '18 12:08 ghost

I am also running into the issue. This only started happening after we changed the target SDK of our app to 27. Previously, we were targeting SDK 22.

btav avatar Aug 27 '18 16:08 btav

@intothefantasy It seems that (starting from API 26) you now have to set the importance instead of the priority, which might be why your change didn't affect the outcome.

@btav made a PR (https://github.com/zo0r/react-native-push-notification/pull/849) to resolve the issue.

senne-af avatar Aug 28 '18 14:08 senne-af

can i know how to set the importance?

ghost avatar Aug 28 '18 14:08 ghost

You can change this line: https://github.com/zo0r/react-native-push-notification/blob/97084450f90d30a0c6b63efa09f3f6dd3f5f8ea9/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java#L495

senne-af avatar Aug 28 '18 14:08 senne-af

changed to IMPORTANCE_HIGH helped me to solved this issue. Thanks alot @sennevc

ghost avatar Aug 28 '18 14:08 ghost

set IMPORTANCE_HIGH and PRIORITY_HIGH not resolved in android 8.0;

PushNotification.localNotification() work fine, but schedule not.

ThiagoGodinhoPaschoalin avatar Sep 17 '18 15:09 ThiagoGodinhoPaschoalin

Exactly +1

kunal886496 avatar Oct 15 '18 11:10 kunal886496

+1

gbertoncelli avatar May 08 '19 10:05 gbertoncelli

@tgptecnology how did you solve the problem?

ilariowiz avatar Aug 01 '19 10:08 ilariowiz

add this line below in AndroidManifest.xml. It solve my problem for heads up remote notification in android

<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name" android:value="XXXXX"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description" android:value="XXXXX"/>
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="rn-push-notification-channel-id" />

see #942

dgana avatar Mar 19 '20 14:03 dgana