9

S3の通知LEDも使用する通知を使用しようとしていますが、何らかの理由で色が常に青色になります(これがデフォルトだと思いますか?)。いろいろな色を使ってみましたが、何も変わりません。他のアプリ(Whatsapp、Gmail、Facebookなど)は、異なる色のライトを表示しても問題ありません。

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);
4

2 に答える 2

11

設定によってすべてのデフォルトが上書きされることを確認する必要があります

notification.defaults = 0;

于 2013-02-19T12:42:35.933 に答える
-1

以下のソースを見てください。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));
于 2016-11-15T13:13:51.903 に答える