Skip to content

Commit

Permalink
Crash on Android 7 when using 'largeIcon' #88
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed May 26, 2017
1 parent 9eb4c33 commit 9853a69
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/android/com/plugin/gcm/CordovaGCMBroadcastReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
Expand Down Expand Up @@ -141,7 +143,8 @@ public void createNotification(Context context, Bundle extras) {
final Notification notification = mBuilder.build();
final int largeIcon = getLargeIcon(context, extras);
if (largeIcon > -1) {
notification.contentView.setImageViewResource(android.R.id.icon, largeIcon);
final Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), largeIcon);
mBuilder.setLargeIcon(bitmap);
}

mNotificationManager.notify(appName, notId, notification);
Expand Down

0 comments on commit 9853a69

Please sign in to comment.