-1

I am receiving push notifications from the server which creates recommendation and posts it to the recommendation row. However, the recommendation card is sometimes smaller sometimes bigger. I am loading the images with glide into a Bitmap object, than I set it in builder. When I get the bigger card, it displays the image, when I get the smaller card, it wont display the image. This is happening even when i send more than 1 same notification with same content (same source image). I tried to load the images and crop them all into same size but that did not help.

This is my Recommendation build():

Notification notification = new NotificationCompat.BigPictureStyle(
            new NotificationCompat.Builder(mContext)
                    .setAutoCancel(true)
                    .setContentTitle(mTitle)
                    .setContentText(mDescription)
                    .setPriority(mPriority)
                    .setLocalOnly(true)
                    .setOngoing(true)
                    .setColor(mContext.getResources().getColor(R.color.fastlane_background))
                    .setCategory(Notification.CATEGORY_RECOMMENDATION)
                    .setLargeIcon(mCardImageBitmap)
                    .setSmallIcon(mSmallIcon)
                    .setContentIntent(mIntent))
            .build();
parohy
  • 2,070
  • 2
  • 22
  • 38

1 Answers1

0

The problem was in the Glide itself. It seems that the image was loaded after the Recommendation was built. I changed the load as asynctask and on completion create recommendation. it works like charm

parohy
  • 2,070
  • 2
  • 22
  • 38