我的 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 …Run Code Online (Sandbox Code Playgroud)