我的 Xamarin.Android 應用的推送通知僅適用于 Android 11 (Pixel 3 XL)。目前我的應用面向 Android 11,但它也可以在 Android 12 (Pixel 6 Pro) 上運行。唯一不起作用的是 Firebase 推送通知。下面是我正在使用的代碼。在過去的一周里,我一直在研究這個問題,并看到有關 Android 12 (Pixel 6) 沒有收到推送通知的特定問題的帖子。我對其他人建議的手機配置進行了更改,另一個應用程式通知開始作業,但我的仍然沒有。任何想法都會有所幫助。謝謝。
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);
}
uj5u.com熱心網友回復:
找到了解決方案。這是在 AndroidManifest 中的 Firebase 服務標簽上添加android:exported="false" 。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/424310.html
