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});'。據我所知,它假設是{延遲,振動,睡眠,振動,睡眠}模式 –