Home > Software design >  Firebase Push notification not receiving on Android 12
Firebase Push notification not receiving on Android 12

Time:02-16

My Xamarin.Android app's push notification only works on Android 11 (Pixel 3 XL). Currently my app targets Android 11, however it also runs on Android 12 (Pixel 6 Pro). The only thing that is not working is Firebase push notifications. Below is the code that I am using. For the past week I have been researching the issue and saw posts about a specific issue with Android 12 (Pixel 6) not recieving push notifications. I performed changes to the phone configurations that others suggested and another app notification began to work, yet mine still has not. Any ideas would help.Thanks.

 if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
            {
                // Notification channels are new in API 26 (and not a part of the
                // support library). There is no need to create a notification
                // channel on older versions of Android.


                var name = "NameOfChannel";
                var description = "Notification Channel";
                var channel = new NotificationChannel(CHANNEL_ID, name, NotificationImportance.Max)
                {
                    Description = description
                };

                var notificationManager = (NotificationManager)GetSystemService(NotificationService);
                notificationManager.CreateNotificationChannel(channel);

            }       

CodePudding user response:

Found the solution. Which was to add android:exported="false" on the Firebase service tag within the AndroidManifest.

  • Related