gpt4 book ai didi

android - 在 Android 12 上未收到 Firebase 推送通知

转载 作者:行者123 更新时间:2023-12-04 23:55:39 39 4
gpt4 key购买 nike

我的 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);

}

最佳答案

我错过的是

PendingIntent.FLAG_IMMUTABLE
如果 Notification 有 pendingIntent 然后设置可变/不可变标志给它

关于android - 在 Android 12 上未收到 Firebase 推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71013083/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com