title: Large Icon Bitmap appears as white square in notification?
body: <p>I am having this problem where I generate a <code>Bitmap</code> from a URL that I use in my notification. However, on my phone, the <code>Bitmap</code> shows up like a small white square. I looked into it and found many posts like so talking about it: <a href="https://stackoverflow.com/questions/30795431/icon-not-displaying-in-notification-white-square-shown-instead">Icon not displaying in notification: white square shown instead</a> </p>
  
  <p>and I know for sure my <code>Small Icon</code> for the notification indeed is transparent. However, for the <code>Large Icon</code>, I realize that the <code>Large Icon</code> cannot be transparent because it is actually a <code>Bitmap</code> that I generate from a URL. How can I get around this then and make sure that the image renders properly instead of having the <code>Large Icon</code> show up as a white square? Here is my attempt:</p>
  
  <p>NotificationService.java:</p>
  
  <pre><code>    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
              .setContentTitle(getString(R.string.app_name))
              .setContentText(remoteMessage.getNotification().getBody())
              .setTicker(remoteMessage.getFrom() + " has responded!")
              .setLargeIcon(AndroidUtils.getBitmapFromURL(remoteMessage.getNotification().getIcon()))
              .setAutoCancel(true)
              .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
              .setStyle(new NotificationCompat.BigTextStyle().bigText(remoteMessage.getNotification().getBody()))
              .setSmallIcon(R.drawable.ic_tabs_notification_transparent);
  </code></pre>
  
  <p>AndroidUtils.java: </p>
  
  <pre><code>public static Bitmap getBitmapFromURL(String userId) {
          try {
              URL imgUrl = new URL("https://graph.facebook.com/" + userId + "/picture?type=large");
              InputStream in = (InputStream) imgUrl.getContent();
              Bitmap  bitmap = BitmapFactory.decodeStream(in);
              Bitmap output;
              Rect srcRect;
              if (bitmap.getWidth() &gt; bitmap.getHeight()) {
                  output = Bitmap.createBitmap(bitmap.getHeight(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
                  srcRect = new Rect((bitmap.getWidth()-bitmap.getHeight())/2, 0, bitmap.getWidth()+(bitmap.getWidth()-bitmap.getHeight())/2, bitmap.getHeight());
              } else {
                  output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getWidth(), Bitmap.Config.ARGB_8888);
                  srcRect = new Rect(0, (bitmap.getHeight()-bitmap.getWidth())/2, bitmap.getWidth(), bitmap.getHeight()+(bitmap.getHeight()-bitmap.getWidth())/2);
              }
  
              Canvas canvas = new Canvas(output);
  
              final int color = 0xff424242;
              final Paint paint = new Paint();
              final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
  
              float r;
  
              if (bitmap.getWidth() &gt; bitmap.getHeight()) {
                  r = bitmap.getHeight() / 2;
              } else {
                  r = bitmap.getWidth() / 2;
              }
  
              paint.setAntiAlias(true);
              canvas.drawARGB(0, 0, 0, 0);
              paint.setColor(color);
              canvas.drawCircle(r, r, r, paint);
              paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
              canvas.drawBitmap(bitmap, srcRect, rect, paint);
              return output;
          } catch (IOException e) {
              FirebaseCrash.report(e);
              return null;
          }
  </code></pre>
  
  <p>Image showing my problem:</p>
  
  <p><a href="https://i.stack.imgur.com/Fkszn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fkszn.jpg" alt="enter image description here"></a></p>
  
  <p>EDIT: Build.gradle file showing:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 23
      buildToolsVersion "23.0.1"
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_7
          targetCompatibility JavaVersion.VERSION_1_7
      }
      defaultConfig {
          applicationId '&lt;ID&gt;'
          multiDexEnabled true
          minSdkVersion 21
          targetSdkVersion 23
          versionCode 12
          versionName ".12"
          signingConfig signingConfigs.Tabs
      }
      buildTypes {
          release {
              minifyEnabled false
              shrinkResources false
              zipAlignEnabled true
              debuggable false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
              signingConfig signingConfigs.Tabs
          }
          debug {
              applicationIdSuffix ".debug"
              debuggable true
              minifyEnabled false
              signingConfig signingConfigs.Tabs
          }
      }
      //DatabaseReference stuff
      packagingOptions {
          exclude 'META-INF/LICENSE'
          exclude 'META-INF/LICENSE-FIREBASE.txt'
          exclude 'META-INF/NOTICE'
      }
      dexOptions {
          javaMaxHeapSize "4g"
      }
      productFlavors {
      }
  }
  </code></pre>