Answer the question
In order to leave comments, you need to log in
How to make a heads-up notification when the app is in the background?
1. Instagram manages to send heads-up notifications (a floating card on top of other apps) even when the app is minimized. The same thing, for example, when an SMS arrives or a call is made on WhatsApp. As far as I was able to google, if the application is minimized, then notifications can only come to the tray, but not be shown on top of other applications. I am sending notifications via firebase console. How to make notifications like instagram?
Maybe it's in firebase and instead you need to use another notification provider, for example onesignal?
2. I was able to make heads-up notifications in the emulator when the application is deployed on the screen. But the same conditions on a real device (Huawei 5A) show a notification only in the tray (the android version is the same as in the emulator). What else is the problem here?
3. Heads-up notifications can only be on one line, shortening the text of the notification?
Answer the question
In order to leave comments, you need to log in
In the onMessageReceived method in your FirebaseMessagingService something like:
if((Build.VERSION.SDK_INT < Build.VERSION_CODES.M || Settings.canDrawOverlays(this))) {
new NotificationPopupView(intent, pushNotification.getTitle(), pushNotification.getBody());
}
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question