var notificationBuilder = new Notification.Builder(context)
.SetSmallIcon(Resource.Drawable.Icon)
.SetLargeIcon(BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.Icon))
.SetContentTitle(title)
.SetContentText(message)
.SetAutoCancel(true)
.SetContentIntent(pendingIntent)
.SetStyle(new Notification.BigTextStyle().BigText(message))
.SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Notification))
.SetVibrate(new long[] { 1000, 1000 })
.SetDefaults(NotificationDefaults.All);
var notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService);
notificationManager.Notify(0, notificationBuilder.Build());
我在哪里错了?为什么我的通知没有任何声音或振动?Android通知声音不起作用
你有相应的权限在'AndroidManifest.xml'中? –
@ th3pat3l,我只是加了这个。 android.permission.VIBRATE –
尝试将振动更改为:SetVibrate(new long [] {1000,1000,1000,1000,1000});'。据我所知,它假设是{延迟,振动,睡眠,振动,睡眠}模式 –