This might be duplicate with this question but still not able to implement notification without heads-up view.
Problem statement : want to show the notification when playing a song. binding one notification with music service that floats on top of the window (Shows a heads-up view) it's very annoying.
Is there any way to disable that heads-up view, just want to show a small icon in status bar.
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getApplicationContext(), CHANNEL)
.setContentTitle("titile")
.setContentText("desc")
.setSmallIcon(R.drawable.logo)
.setColor(getResources().getColor(R.color.colorPrimary))
.setPriority(NotificationCompat.PRIORITY_LOW)
.setAutoCancel(true);
Notification notification = notificationBuilder.build();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel notificationChannel = new NotificationChannel(
CHANNEL, "Halt", NotificationManager.IMPORTANCE_NONE
);
mNotificationManager.createNotificationChannel(notificationChannel);
}
mNotificationManager.notify(NOTIFICATION_ID, notification);
答案 0 :(得分:0)
花了一些时间后,我只是卸载并重新安装了该应用程序并开始工作。
越野车