我需要在显示应用程序处于睡眠模式的通知之前检查。我使用通知作为警报,如果应用程序处于活动状态,则无需显示通知是否可以检查应用程序的睡眠状态?
var builder = new Notification.Builder(context)
.SetPriority((int)NotificationPriority.High)
.SetVisibility(NotificationVisibility.Public)
.SetDefaults(NotificationDefaults.Vibrate)
.SetCategory(Notification.CategoryAlarm)
.SetContentIntent(contentIntent)
.SetSmallIcon(Resource.Drawable.icon)
.SetContentTitle(title)
.SetContentText(message)
.SetWhen(Java.Lang.JavaSystem.CurrentTimeMillis())
.SetAutoCancel(true);
var notification = builder.Build();
manager.Notify(0, notification);