0
ARGB 색상의 알림 LED에 대한 맞춤 색상을 설정하려고했습니다.Android Studio : ARGB가있는 알림 LED의 사용자 정의 색상이 작동하지 않습니다.
NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification.Builder(this)
.setDefaults(0)
.setTicker("")
.setSmallIcon(R.drawable.maxapplogo)
.setContentTitle("Notification")
.setContentText("This is a notification test!")
.setAutoCancel(true)
.setVibrate(new long[] { 1000, 500, 1000, 500, 1000 })
.setLights(Color.GREEN, 1000, 1000)
.build();
/* notification.ledARGB = 0xffffee05; */
/* here I wanted to know if the int values of the color can help me */
int black = Color.BLACK;
Log.d("black color", String.valueOf(black)); // -16777216
int green = Color.GREEN;
Log.d("green color", String.valueOf(green)); // -16711936
int red = Color.RED;
Log.d("red color", String.valueOf(red)); // -65536
notification.flags = Notification.FLAG_SHOW_LIGHTS;
if(notificationManager != null) {
notificationManager.notify(0, notification);
} else {
Toast.makeText(getApplicationContext(), "Notification failed", Toast.LENGTH_SHORT).show();
}
COLOR.GREEN 명령 또는 다른 사용 가능한 색상으로 색상을 설정하면 작동합니다. 그러나 ARGB 사양에서는 작동하지 않습니다. ARGB 색상이 다른 경우에도 항상 동일한 색상을 표시합니다.
삼성 갤럭시 S8에서 내 앱을 테스트했습니다. 테스트 할 다른 스마트 폰이 없습니다. 누군가 이것이 이것이 효과가없는 이유를 알고 있습니까? 그것은 다른 Stackoverflow 게시물에 따라해야합니다.
를 사용해야합니다. – Max
sdk> 23 인 경우 다른 사람이 알림 관리자를 사용하는 경우 이것을 사용하십시오. – Hangman