アプリアイコンや,PUSH通知のアイコン指定の際には、
下記のように(manifestのファイル一部とpushの一部分です)mipmapを指定して
作成してきましたが、いつもならAndroid Studioのソースコードを記載する横の部分(デバッグポイント?)みたいな赤丸をつけられる部分に、設定しているアイコンが表示されていました。ですが、なぜかprojectファイルごとにそれが表示されているものと、表示されていないものがあります。
アイコンが横のバーに表示されていないアプリはpush通知をバックグラウンドで受け取った時に背景が白色の何も設定していない時の表示になっています。
なぜこのようなことが起きるのでしょうか?
何か知っている方がいたら情報をお願いします。
追記:
pushにはFCMを使用していて、アプリがフォアグラウンドの時はmipmapに登録してある画像が使われているのですが、バックグラウンドの時はデフォルトのグレーの背景に白い四角いアイコンになってしまいます。まぁそれはFCMの仕様というか、そうなるらしくバックグラウントだとonMessageReceived()メソッドが呼ばれないからアイコンなどが表示されないっぽいです。
それは理解したのですが、何故下記のコードでバックグラウンドでも表示されるものとされないものがあるのか本当にわかりません。
<application android:name=".GlobalApplication" android:icon="@mipmap/ic_launcher" android:allowBackup="true" android:label="@string/app_name" android:supportsRtl="true" android:largeHeap="true" android:theme="@style/AppTheme.NoActionBar">
//push(FCM)の記載部分 private void sendNotification(String message) { Intent intent = new Intent(this, MainActivity.class);//MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 , intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.push) .setLargeIcon(BitmapFactory.decodeResource(getResources(),R.mipmap.ic_launcher)) .setContentTitle("テストアプリ") .setContentText(message) .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0, notificationBuilder.build()); }