I am developing an app in Flutter which uses firebase notifications. When app is opened then i showed a popup message within app. and when app is killed then i recieved the notification in
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
This works perfectly fine when the app is not signed. but i generate a signed app then in app notifications are working perfectly, when is in background then it also works, but the app is signed and is complety killed then this function don't got hit.
Here is Flutter Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.19045.2364], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.19)
[√] Android Studio (version 2021.3)
[√] VS Code, 64-bit edition (version 1.17.2)
[√] Connected device (3 available)
[√] HTTP Host Availability
• No issues found!
And using these along with other in pubspec.xaml
awesome_notifications: ^0.6.19
firebase_core: ^2.4.0
firebase_messaging: ^14.1.4
and in my app level build.gradle
compileSdkVersion 33
and
defaultConfig {
applicationId "com.dummy.dummy"
minSdkVersion 21
targetSdkVersion 31
versionCode 292
versionName '292'
multiDexEnabled true
}
this only not work when app is signed, in-app notification works fine but background don't work, but work with debug un-signed app
THanks
If I'm understanding correctly you want your notification to do something
when entering from terminated state. getInitialMessage
method:
Quick doc from messaging.dart implementation:
/// If the application has been opened from a terminated state via a [RemoteMessage]
/// (containing a [Notification]), it will be returned, otherwise it will be `null`.
///
/// Once the [RemoteMessage] has been consumed, it will be removed and further
/// calls to [getInitialMessage] will be `null`.
///
/// This should be used to determine whether specific notification interaction
/// should open the app with a specific purpose (e.g. opening a chat message,
/// specific screen etc).
Future<RemoteMessage?> getInitialMessage() {
return _delegate.getInitialMessage();
}