我正在尝试为通知设置振动和声音。出于某种原因,它对我不起作用:(这是我正在尝试的代码
NotificationManager notificationManager = getNotificationManager();
NotificationCompat.Builder builder = new NotificationCompat.Builder(
context);
builder.setSound(alarmSound);
builder.setVibrate(new long[] { 1000, 1000, 1000 });
Notification notification = builder.setContentIntent(contentIntent)
.setSmallIcon(icon).setTicker(title).setWhen(0)
.setAutoCancel(true).setContentTitle(title).setPriority(Notification.PRIORITY_HIGH)
.setStyle(new NotificationCompat.BigTextStyle().bigText(msgToDisply))
.setContentText(msgToDisply).build();
notificationManager.notify(NOTIFICATION, notification);
stopSelf();
和
public NotificationManager getNotificationManager() {
return (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
}
我在我的清单中获得了许可
<uses-permission android:name="android.permission.VIBRATE" />
有什么线索吗?