I've got my notifications to work well on my app with API range being 21-26. I spent two hours looking this up and I couldn't really find a solution. I could've been searching the wrong thing but this is what I'm looking for:
Here is my notification manager code:
@TargetApi(26)
private void runNotificationManager() {
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
id = "auto_birthday_01";
CharSequence name = getString(R.string.channel_name);
String description = getString(R.string.channel_description);
int importance = NotificationManager.IMPORTANCE_MIN;
NotificationChannel mChannel = new NotificationChannel(id, name, importance);
mChannel.setDescription(description);
mChannel.enableVibration(false);
mNotificationManager.createNotificationChannel(mChannel);
}
Here is my notification code:
private void runNotification(NotificationManager notificationManager) {
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, id);
builder.setSmallIcon(R.drawable.ic_stat);
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this,
0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pendingIntent);
builder.setLargeIcon(
BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_round));
builder.setContentTitle("Title!");
builder.setContentText("Open.");
builder.setOngoing(true);
notificationManager.notify(1, builder.build());
}
All I get is the standard notification all the way on top. Thank you.