react-native-push-notification
react-native-push-notification copied to clipboard
Android 13 problem - POST_NOTIFICATIONS
It seems like notifications won't work on Android 13 unless you add
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
to your manifest file.
https://developer.android.com/develop/ui/views/notifications/notification-permission#declare
this also requires requesting permissions explicitly... can someone please provide a sample code for that?
This seems to work:
import { PermissionsAndroid } from 'react-native';
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
Thanks @bananer, I'm definitely going to give it a shot :)
Heyy @bananer I have tried this as well, for me some devices are getting the push notifications and some are not for the android built apk.
But, User deny the permission how again ask it?
for anyone else having issues receiving remote notifications, you may need
<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
even though readme says you only need if you want to use localNotificationSchedule
Heyy @bananer I have tried this as well, for me some devices are getting the push notifications and some are not for the android built apk.
same , if you got the solution for it can you let me know alos?
The same problem. PushNotification.configure is in index.js. Working on Android less then 13. Push notifications work when the app is in the foreground. Once it's off or in the background and a notification comes in, it kills the app.
Set environment according to https://dev.to/gautham495/asking-notification-permission-in-android-13-for-a-react-native-application-35n2
How can I ask notification permission for Android 13 and above in react native version 0.61?