From 1065da73d25744842ee726e3a85b938e2edac5ed Mon Sep 17 00:00:00 2001 From: huyufei Date: Wed, 4 Sep 2024 17:23:12 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=20Android=20Notifi?= =?UTF-8?q?cation=20ChannelID=20=E7=9A=84=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyufei --- .../GuruCore/Runtime/Firebase/FirebaseUtil.Message.cs | 10 ++++++---- .../Manager/NotificationAgentAndroid.cs | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Message.cs b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Message.cs index 28da19c..30ba81d 100644 --- a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Message.cs +++ b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Message.cs @@ -56,7 +56,8 @@ namespace Guru } var token = task.Result; - if (string.IsNullOrEmpty(token)) + if (string.IsNullOrEmpty(token) + && string.IsNullOrEmpty(IPMConfig.IPM_PUSH_TOKEN)) { DelayGetFCMToken(10); return; @@ -64,9 +65,10 @@ namespace Guru Debug.Log($"[Firebase] --- GetPushToken:{token}"); - IPMConfig.IPM_PUSH_TOKEN = token; - IPMConfig.IS_UPLOAD_DEVICE_SUCCESS = true; - + if (!string.IsNullOrEmpty(token)) + { + IPMConfig.IPM_PUSH_TOKEN = token; + } UploadDeviceInfo(); }); } diff --git a/Runtime/GuruNoification/Manager/NotificationAgentAndroid.cs b/Runtime/GuruNoification/Manager/NotificationAgentAndroid.cs index 585c8d6..6953527 100644 --- a/Runtime/GuruNoification/Manager/NotificationAgentAndroid.cs +++ b/Runtime/GuruNoification/Manager/NotificationAgentAndroid.cs @@ -9,7 +9,8 @@ namespace Guru.Notification public class NotificationAgentAndroid : INotificationAgent { - public const string FCM_DEFAULT_CHANNEL_ID = "fcm_default_channel"; + private const string FCM_DEFAULT_CHANNEL_NAME = "fcm_default_channel"; + private const string FCM_DEFAULT_CHANNEL_ID = "default_notification_channel_id"; private const string STATUS_GRANTED = "granted"; private const string STATUS_DENIDED = "denied"; // private const string STATUS_NOT_DETERMINED = "not_determined"; @@ -160,7 +161,7 @@ namespace Guru.Notification // 低版本处理方式 Debug.Log($"[SDK][Noti] --- #2 SDK {sdkInt} not requested -> open channel"); AndroidNotificationCenter.RegisterNotificationChannel(new AndroidNotificationChannel(FCM_DEFAULT_CHANNEL_ID, - FCM_DEFAULT_CHANNEL_ID, "", Importance.Default)); // 打开ChannelID + FCM_DEFAULT_CHANNEL_NAME, "", Importance.Default)); // 打开ChannelID SetGrantStatus(STATUS_GRANTED); } else