I am getting notification using firebase message service.everything working fine but one problem what I am facing is when clicking on notification I am not able to open the notification details activity. While debugging it is working fine but in the release version, I am not able to find the bug.
Here is my code :
Log.d(TAG, "From: " + remoteMessage.getFrom());
NewsId = remoteMessage.getNotification().getIcon();
NotificationManager manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Intent i = new Intent(this, NotificationDetailActivity.class);
i.putExtra("NewsId", NewsId);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext())
.setSmallIcon(R.mipmap.ic_launcher_round)
.setContentTitle(Html.fromHtml(remoteMessage.getNotification().getTitle()))
.setContentText(remoteMessage.getNotification().getBody())
.setAutoCancel(true)
.setContentIntent(PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT))
.setSound(soundUri);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mBuilder.setSmallIcon(R.mipmap.ic_launcher);
mBuilder.setColor(getResources().getColor(R.color.colorAccent));
} else {
mBuilder.setSmallIcon(R.mipmap.ic_launcher);
}
Notification mNotification = mBuilder.build();
mNotification.flags |= Notification.FLAG_INSISTENT;
// Display notification
notificationManager.notify(100, mNotification);