I tried to push notify with NotificationCompat :
NotificationCompat.Builder b = new NotificationCompat.Builder(this);
b.setAutoCancel(true)
.setDefaults(NotificationCompat.DEFAULT_ALL)
.setWhen(System.currentTimeMillis())
.setSmallIcon(this.getResources().
getIdentifier("ic_launcher", "mipmap", this.getPackageName()))
.setLargeIcon(BitmapFactory.decodeResource(this.getResources(),
this.getResources().
getIdentifier("ic_launcher", "mipmap", this.getPackageName())))
.setTicker("God Reacts")
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setPriority(Notification.PRIORITY_MAX)
.setContentTitle(data.get("lineOne"))
.setContentText(data.get("lineTwo"))
.setContentInfo("Spread the message !");
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
new Intent(this,getMainActivityClass()),
PendingIntent.FLAG_UPDATE_CURRENT);
b.setContentIntent(contentIntent);
NotificationManager nm = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(1, b.build());
But in few devices (Samsung,MI etc) the notification banner is not shown. The notification slides in the action tray with sound and vibrate.
But in few devices it is shown perfectly when the app is closed/background/foreground.The device where it's popping up correctly uses marshmallow.Is is due to specific OS ? Or is it device related issue? What extra I need to add?