更新时间:2022-01-02 23:00:13
在 Oreo(+) 上,您必须通过 EnableVibration(true)
在 NotificationChannel
上启用振动>.
On Oreo(+), you have to enable the vibration on the NotificationChannel
via EnableVibration(true)
.
NotificationChannel channel;
channel = notificationManager.GetNotificationChannel(myUrgentChannel);
if (channel == null)
{
channel = new NotificationChannel(myUrgentChannel, channelName, NotificationImportance.High);
channel.EnableVibration(true);
channel.EnableLights(true);
channel.SetSound(
RingtoneManager.GetDefaultUri(RingtoneType.Notification),
new AudioAttributes.Builder().SetUsage(AudioUsageKind.Notification).Build()
);
channel.LockscreenVisibility = NotificationVisibility.Public;
notificationManager.CreateNotificationChannel(channel);
}
channel.Dispose();