I'm trying to build my own notification as soon as I receive a payload from my server in my FCM Receiver, I set my notification icon to my app icon which is in PNG Format, however, my notification is displayed with a white square instead and I don't know why.. Here's my code:
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.icon)
.setContentTitle("Your chat is going to expire tomorrow!");
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(this, main_activity.class);
resultIntent.putExtra("launchedFromNotification",true);
// The stack builder object will contain an artificial back stack for the
// started Activity.
// This ensures that navigating backward from the Activity leads out of
// your app to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(main_activity.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mNotificationId is a unique integer your app uses to identify the
mNotificationManager.notify(MESSAGE_NOTIFICATION_ID, mBuilder.build());