【发布时间】:2022-07-27 17:16:23
【问题描述】:
我的 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);
}
【问题讨论】:
-
我不确定您遇到什么问题,您是否收到异常或通知未显示......
-
@FreakyAli 当我从 Firebase 控制台同时向 Pixel 3 和 Pixel 6 手机发送测试消息时,只有 Pixel 3 Android 11 收到了消息。 Pixel 6 Android 12 手机的日志中没有显示错误。我检查了我的代码和 FCM 令牌以确保它是正确的。依然没有。谢谢。
-
您是否应用了断点并检查您是否收到了它?
-
据我所知,Android 12 在网络上有一些特别之处。您可以在下面的链接中获得进一步的帮助。 github.com/xamarin/xamarin-android/issues
标签: android xamarin google-cloud-firestore pixel android-12