update: 更新 Android Notification ChannelID 的赋值

Signed-off-by: huyufei <yufei.hu@castbox.fm>
胡宇飞 2024-09-04 17:23:12 +08:00
parent cb6bc4e794
commit 1065da73d2
2 changed files with 9 additions and 6 deletions

View File

@ -56,7 +56,8 @@ namespace Guru
} }
var token = task.Result; var token = task.Result;
if (string.IsNullOrEmpty(token)) if (string.IsNullOrEmpty(token)
&& string.IsNullOrEmpty(IPMConfig.IPM_PUSH_TOKEN))
{ {
DelayGetFCMToken(10); DelayGetFCMToken(10);
return; return;
@ -64,9 +65,10 @@ namespace Guru
Debug.Log($"[Firebase] --- GetPushToken:{token}"); Debug.Log($"[Firebase] --- GetPushToken:{token}");
IPMConfig.IPM_PUSH_TOKEN = token; if (!string.IsNullOrEmpty(token))
IPMConfig.IS_UPLOAD_DEVICE_SUCCESS = true; {
IPMConfig.IPM_PUSH_TOKEN = token;
}
UploadDeviceInfo(); UploadDeviceInfo();
}); });
} }

View File

@ -9,7 +9,8 @@ namespace Guru.Notification
public class NotificationAgentAndroid : INotificationAgent 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_GRANTED = "granted";
private const string STATUS_DENIDED = "denied"; private const string STATUS_DENIDED = "denied";
// private const string STATUS_NOT_DETERMINED = "not_determined"; // 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"); Debug.Log($"[SDK][Noti] --- #2 SDK {sdkInt} not requested -> open channel");
AndroidNotificationCenter.RegisterNotificationChannel(new AndroidNotificationChannel(FCM_DEFAULT_CHANNEL_ID, 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); SetGrantStatus(STATUS_GRANTED);
} }
else else