1

以下代码在装有 Android 2.3.3 的摩托罗拉 Defy 上运行良好,但不适用于 Nexus 4。LED 本身应该没问题,市场上的应用程序颜色 LED 测试仪可以工作。

NotificationManager notif =  (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
final Notification notification = new Notification();
notification.ledARGB = Color.RED;
notification.ledOnMS = 1000;
notification.ledOffMS = 300;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;    
notif.notify(1, notification);

有人知道这里有什么诀窍吗?

4

1 回答 1

3

我刚刚在我的 Nexus 4 上测试了你的代码,它可以工作。但是在考试之前我已经锁定了我的手机。可能此 LED 仅在屏幕关闭时才会突出显示。

于 2013-03-05T09:24:33.610 回答