2013-02-19 2 views
8

S3에서 알림 LED를 사용하는 알림을 사용하려고하지만 어떤 이유로 인해 색상이 항상 파란색으로 표시됩니다 (기본값이라고 생각하십니까?). 다른 색상을 사용하려고했지만 아무 것도 바뀌지 않았습니다. Whatsapp, Gmail 및 Facebook과 같은 다른 앱은 다른 색상의 빛을 나타내는 데 아무런 문제가 없습니다.Android 알림 LED가 내 색상을 사용하지 않습니다.

Notification.Builder noteBuilder = new Notification.Builder(context) 
       .setAutoCancel(true) 
       .setPriority(Notification.PRIORITY_DEFAULT) 
       .setSmallIcon(R.drawable.ic_launcher) 
       .setContentTitle(ContentTitle) 
       .setContentText(ContentText) 
       .setLights(Color.YELLOW, 500, 500) 
       ; 

Intent noteIntent = new Intent(context,HoofdScherm.class); 
PendingIntent notePendingIntent = PendingIntent.getActivity(context, 0, noteIntent, PendingIntent.FLAG_CANCEL_CURRENT); 
noteBuilder.setContentIntent(notePendingIntent); 

Notification note = noteBuilder.build(); 
note.ledARGB = Color.YELLOW; 
NotificationManager mgr = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); 
mgr.notify(0,note); 
+0

일부는 앱의 실행기 아이콘의 기본 색상을 사용하고, 일부는 알림/우선 순위 유형을 사용합니다. –

+0

우선 순위를 설정하지 않으면 변경 될 수 있습니까? 또한 빌드 후 알림을 변경하기 때문에 LED 라이트를 생성하기위한 모든 단계를 추가해야합니다. 또한'notification.ledARGB = 0xff00ff00; notification.ledOnMS = 300; notification.ledOffMS = 1000; notification.flags | = 알림 .FLAG_SHOW_LIGHTS; ' –

+0

우선 순위를 변경하려고했으나 (기본값은 높음을 사용하고 alzo는 설정하지 않았습니다). 그것은 차이를 만들지 않았다. 다음으로 다른 아이콘을 사용하려고 시도 하겠지만 라이트 관리자와 같은 앱이 내 S3에서 알림 색상을 설정할 수 있기 때문에 차이가 있다고 생각하지 않습니다. 'notification.defaults = 0;'을 추가하는 –

답변

11

당신은 notification.defaults = 0;

+0

이것은 나에게 효과가없는 것 같습니다. 어디서 기본값을 0으로 설정하고 있습니까? 'notification note = noteBuilder.build();'의 뒤에'note.ledARGB = Color.YELLOW;'의 전에? 나는 내 우선 순위를 최대로 설정했고 넥서스 5를 테스트 중입니다. – toobsco42

+0

그래서 내 장치가 절전 모드에 있지 않다는 것을 알아 냈습니다. 알림 트레이가 이미 풀리지 않았는지 (예 : 사용자가 알림을 보지 않았 음) 확인해야합니다. 이 경우 LED가 깜박입니다. http://stackoverflow.com/questions/3297835/how-can-i-enable-vibration-and-lights-using-the-android-notifications-api – toobsco42

-1

아래 소스에 보라 설정에 의해 무시되어 있는지 모든 기본값을 확인해야합니다. S3에서 완벽하게 작동 : LED의 색상 설정이 API의 일부 임에도 불구하고 실제로 대부분의 장치에서 매우 다르고 모든 장치에서 작동하지는 않지만, S3에서

NotificationCompat.Builder mBuilder = 
       new NotificationCompat.Builder(ctx) 
         .setPriority(Notification.PRIORITY_HIGH) 
         .setSmallIcon(getNotificationIcon()) 
         .setColor(0xff493C7C) 
         .setContentTitle(ctx.getString(R.string.app_name)) 
         .setContentText(msg) 
         .setDefaults(Notification.DEFAULT_SOUND) 
         .setLights(0xff493C7C, 1000, 1000) 
         .setStyle(new NotificationCompat.BigTextStyle().bigText(styledMsg)); 
관련 문제