1

I have a expanded notification but its opening expanded form by default. How can I open notification collapsed form by default?

notification = new NotificationCompat.Builder(context, CHANNEL_ID)
    .setVisibility(NotificationCompat.VISIBILITY_SECRET)
    .setContentIntent(contentIntent)
    .setOngoing(true) //making fixed notification (uncancellable when we scroll)
    .setOnlyAlertOnce(true) //show notification only first time
    .setShowWhen(false)
    .addAction(playbutton, "Play", pendingIntentplay)
    .addAction(closebutton, "Close", pendingIntentClose)
    .setStyle(new androidx.media.app.NotificationCompat.MediaStyle()
        .setShowActionsInCompactView(0, 1)
        .setMediaSession(mediaSessionCompat.getSessionToken()))
    .setPriority(NotificationCompat.PRIORITY_HIGH)
    .setSmallIcon(R.drawable.logo_feelo)
    .setLargeIcon(icon)
    .setContentTitle(track.getTitle())
    .build();
notificationManagerCompat.notify(1, notification);
flaxel
  • 4,173
  • 4
  • 17
  • 30
  • Check out the below link. https://stackoverflow.com/q/64816401/9466230 Hopefully helpful for you. – qwerty Sep 30 '21 at 09:07

0 Answers0