2017-10-14 1 views
0

내 앱의 알림 아이콘 설정이 멈췄습니다.알림 아이콘 앱 배경 android

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context) 
      .setSmallIcon(R.mipmap.ic_launcher) 
      .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), 
        R.drawable.ic_stat_ic_notification))..... 

이 : 응용 프로그램이 제대로 열리지 작품을 때

<meta-data 
android:name="com.google.firebase.messaging.default_notification_icon" 
android:resource="@drawable/ic_stat_ic_notification" /> 
<meta-data 
android:name="com.google.firebase.messaging.default_notification_color" 
android:resource="@color/colorAccent" /> 

그래서, 내가 드로어 블 이미지를 볼 수 내 코드에서 나는 모두이 있습니다. 그러나 앱이 백그라운드에 있거나 닫힌 경우 빈 이미지가 표시됩니다. 이 빈 이미지가 내 앱 아이콘의 회색 버전이라고 가정합니다.

올바르게 입력 했습니까? 앱이 백그라운드에있는 경우 알림을위한 이미지를 설정하려면 어떻게해야합니까?

알림 표시 방법을

편집

:

https://imgur.com/a/d1T37

+0

해당 문서를 살펴보십시오. 도움이 될지도 모릅니다. https://firebase.google.com/docs/cloud-messaging/android/receive –

+0

@ruch ehm .. Google Firebase 웹 사이트에서 모두 읽었습니다. 정보가 충분하지 않기 때문에 여기에 있습니다. – lucacatr

+0

'아이콘이 알림에 표시되지 않음 : 대신 흰색 사각형이 표시됨'(https://stackoverflow.com/questions/30795431/icon-not-displaying-in-notification-white-square-shown-instead) – nomag

답변

1
NotificationCompat.Builder builder = new NotificationCompat.Builder(this) 
      .setSmallIcon(R.drawable.icon_logo) 
      .setContentTitle(title.toString()) 
      .setSound(defaultSoundUri) 
      .setPriority(Notification.PRIORITY_MAX) 
      .setContentText(sp.toString()); 

이를 사용하여 시도는 icon_logo는 드로어 블의 아이콘 이미지입니다.

+0

아니요, 이미 시도했습니다 ... 저는 항상 빈 칸을 가지고 있습니다. – lucacatr

+0

내 응용 프로그램에서 잘 작동하고 공유 할 수있는 코드가 더 있거나 코드를 공유 할 수 있습니다. – aditya1508

+0

Android 6에서도 작동하며 앱이있는 경우에도 작동합니다. 배경? – lucacatr