1

I am building an social media app in Android studio, this app uses firebase for push notifications, and notifications is working fine, that Is notifications shows on device's notification bar.

How can I change the behavior so that the notification can appear as popup when app is in foreground?

I want a persistent kind of notification, something like WhatsApp that can stay on top other apps so that users can quickly open notification on wherever they are on their phone.

On my research, the best i could get was to use this on my theme

But I do not have Theme.Holo.Dialog in my style and my aim is that the notification should appear even if app is not open.

Thank you for looking into this

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Karmar
  • 47
  • 1
  • 1
  • 7

1 Answers1

0

You should use heads-up notifications

For this purposes you should use notification channel with high a importance: How to set importance in the notification channel.

In this answer you can find code sample, how to show notification in the channel with high importance(to show notification even if the app in the foreground): https://stackoverflow.com/a/67953864/16210149

Hope it would be helpful.

Anatolii Chub
  • 1,228
  • 1
  • 4
  • 14