namespace HeartRateMonitorAndroid.Services.Platform { /// /// iOS平台通知服务实现 /// public class IosNotificationService : INotificationService { /// /// 初始化通知服务 /// public void Initialize() { #if IOS // 请求iOS通知权限 Platforms.iOS.IosNotificationHelper.RequestNotificationPermission().ConfigureAwait(false); #endif } /// /// 显示心率通知 /// public void ShowHeartRateNotification(int currentHeartRate, double avgHeartRate, int minHeartRate, int maxHeartRate, TimeSpan duration) { string title = "心率监测"; string content = $"当前心率: {currentHeartRate} bpm 平均: {avgHeartRate:0} bpm"; #if IOS Platforms.iOS.IosNotificationHelper.ShowNotification(title, content); #endif } /// /// 取消通知 /// public void CancelNotification() { #if IOS Platforms.iOS.IosNotificationHelper.CancelAllNotifications(); #endif } /// /// 显示重连通知 /// public void ShowReconnectionNotification(string title, string message, int attemptCount) { #if IOS Platforms.iOS.IosNotificationHelper.ShowNotification(title, message); #endif } } }