私のJavaコード:以下のコードを使用していますが、動作しません。Facebookのようなロリポップバージョンの通知アイコンを設定する方法
Intent intent = new Intent(context, LiveFeedScreen.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
final int not_nu = generateRandom();
PendingIntent pendingIntent = PendingIntent.getActivity(context,
not_nu, intent, PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(
context)
.setSmallIcon(R.drawable.notificationbig_icon)
.setColor(context.getResources().getColor(R.color.header_blue))
.setContentTitle(context.getString(R.string.app_name))
.setContentText(mMessage)
.setAutoCancel(true)
.setStyle(
new NotificationCompat.BigTextStyle().bigText(mMessage))
.setContentIntent(pendingIntent);
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(not_nu, notificationBuilder.build());
これはロリポップの下でのみ動作しますが、そのイメージは非常に小さく表示されます。
画像の解像度が適切なサイズでない場合がありますか?異なるデバイスでそれを比較し、イメージのサイズが一貫しているかどうかを確認してください。 – Subby
あなたの要件に合わせてチェックしてください。 –
ic_launcherを同じアイコンに設定してください。 .setLargeIcon(BitmapFactory.decodeResource(context.getResources()、R.mipmap.ic_launcher)) –