Reputation: 598
I managed to make a Firebase cloud function to send me notifications of the latest chat msg. Everything works well.
The notifications arrive when the app is in the background or never started but I can still receive it while the app is in the foreground just fine.
Working fine:
The Problem:
Idea:
Upvotes: 3
Views: 2241
Reputation: 1618
Write something like in MainActivity.kt
this if you use Kotlin:
package com.posignal.app
import android.app.NotificationManager
import android.content.Context
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
override fun onResume() {
super.onResume()
closeAllNotifications();
}
private fun closeAllNotifications() {
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.cancelAll()
}
}
Upvotes: 2