Dart
Dart

Reputation: 135

Notification without heads-up View

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);

Upvotes: 0

Views: 262

Answers (1)

Dart
Dart

Reputation: 135

After spending some time, I just uninstall and reinstall the application and start works.

Buggy Rocks

Upvotes: 1

Related Questions