android push notification on schedule not showing drop down from top
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.
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
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
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.
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
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.
@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.
can i know how to set the importance?
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
changed to IMPORTANCE_HIGH helped me to solved this issue. Thanks alot @sennevc
set IMPORTANCE_HIGH and PRIORITY_HIGH not resolved in android 8.0;
PushNotification.localNotification() work fine, but schedule not.
Exactly +1
+1
@tgptecnology how did you solve the problem?
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