使用NotificationCompat时,通知导致无法正常工作?

时间:2013-08-11 15:49:28

标签: android android-notifications

在我的通知中,我希望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());

0 个答案:

没有答案