2

I want to show the notification in the background. Means, while user opening the notification screen.

But its coming on the top of my app screen. I don't want to show at the top of the my app.

I want to show only in the notification bar.

Can someone suggest, what is the property that I have to set.

shb
  • 5,957
  • 2
  • 15
  • 32
simple
  • 159
  • 1
  • 9

1 Answers1

3

Make sure your activity is not full screen.

Set low priority to your notification

NotificationCompat.Builder mBuilder.setContentTitle(fileName)
                .setContentText("Notification")
                .setSmallIcon(R.drawable.icon)
                .setPriority(NotificationCompat.PRIORITY_LOW)
                .setAutoCancel(true)
                .setContentIntent(pendingIntent);

and low importance to your notification channel

NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, IMPORTANCE_LOW);
shb
  • 5,957
  • 2
  • 15
  • 32