1

On my Android 10 device, I see that the LastPass app is able to create a "Persistent notification". As seen in this screenshot below:

enter image description here

I have an application which I want to have a persistent notification for running my foreground service. But after all attempts, I don't get the the same observation as the LastPass app with saying its a "persistent notification". It just shows just as a "notification".

Does anyone know how to do this? Does anyone know if it really matters?

BarryBostwick
  • 919
  • 2
  • 12
  • 21

2 Answers2

2

On my Android 10 device, I see that the LastPass app is able to create a "Persistent notification". As seen in this screenshot below:

That is not a "persistent" notification - that is a notification channel, which LastPass has apparently opted to call "Persistent notifications" for whatever reason.

I have an application which I want to have a persistent notification for running my foreground service.

Sounds like you want an ongoing notification.

Hope that helps!

dominicoder
  • 9,338
  • 1
  • 26
  • 32
1

Just make setOngoing true. It will be persistance.

NotificationCompat. Builder(context, CHANNEL_ID) .setOngoing(true)

Saiful Islam Sajib
  • 2,243
  • 1
  • 12
  • 17