在我的通知中,我希望 LED 以白色闪烁。我正在使用支持库中的 NotificationCompat 类来构建通知。
通知很好地启动,但 LED 不闪烁。(在 Nexus 4 上测试)
这是代码:
// Build notification
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);
mBuilder.setSmallIcon(R.drawable.ic_stat_notify);
mBuilder.setTicker(getResources().getString(R.string.task_due));
mBuilder.setContentTitle(notify_title).setContentText(notify_descrip);
mBuilder.setDeleteIntent(deleteIntent());
mBuilder.setPriority(Notification.PRIORITY_DEFAULT);
mBuilder.setLights(0xFFFF0000, 500, 500);
mBuilder.setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
// On notification tap
Intent resultIntent = new Intent(this, SpecialActivity.class);
resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent resultPendingIntent = PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
// Notify the user
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(0, mBuilder.build());