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

Android 13 problem - POST_NOTIFICATIONS

Open roeycohen opened this issue 1 year ago • 8 comments

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?

roeycohen avatar May 28 '23 10:05 roeycohen

This seems to work:

import { PermissionsAndroid } from 'react-native';
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);

bananer avatar Jun 22 '23 08:06 bananer

Thanks @bananer, I'm definitely going to give it a shot :)

roeycohen avatar Jun 25 '23 06:06 roeycohen

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.

shivapasunuri avatar Aug 29 '23 05:08 shivapasunuri

But, User deny the permission how again ask it?

sivamani-edumpus avatar Nov 16 '23 07:11 sivamani-edumpus

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

heyalexchoi avatar Dec 12 '23 23:12 heyalexchoi

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?

yashnerkar avatar Jan 09 '24 10:01 yashnerkar

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

mrazekrad avatar Feb 25 '24 07:02 mrazekrad

How can I ask notification permission for Android 13 and above in react native version 0.61?

Faizansiddiqui287 avatar Mar 16 '24 09:03 Faizansiddiqui287