Android Studio通知灯

时间:2017-07-25 14:26:26

标签: android android-notifications

为什么LED灯无法使用此通知?

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                .setDefaults(0)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setContentTitle(remoteMessage.getData().get("username"))
                .setContentText(remoteMessage.getNotification().getBody())
                .setVibrate(new long[]{1500, 0, 1500, 0})
                .setLights(Color.BLUE, 2000, 1000)
                .setWhen(remoteMessage.getSentTime())
                .setAutoCancel(true)
                .setPriority(NotificationCompat.PRIORITY_HIGH)
                .setStyle(new NotificationCompat.BigTextStyle().bigText(remoteMessage.getNotification().getBody()))
                .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
                .setContentIntent(pendingIntent);

        NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(0, notificationBuilder.build());
你能帮忙吗?我找不到错误。

我将notificationBuilder.setDefaults(0)置于顶部,但仍无法正常工作

0 个答案:

没有答案