Description
Describe the bug
A couple days ago I notice that my application stopped showing notifications from firebase just on iOS. I send a POST request to https://fcm.googleapis.com/fcm/send containing the payload, when the app is on background nothing happens, when I open the app the method onMessage
is executed with few fields shown below.
The notification was working from about 2 months since first implementation, it was shown when the app was in background, my payload was not changed but it stopped working.
Expected Behaviour
Show notification when app is in background or killed (as before)
My alternative request with same result:
{
"notification": {
"title": "Title test",
"body": "Body message"
}
"condition": "'match_1474' in topics"
}
My code for debug:
...
_firebaseMessaging.configure(
onBackgroundMessage: myBackgroundMessageHandler, //static method printing message (not get called)
onMessage: (Map<String, dynamic> message) async {
Log.d("onMessage: ${jsonEncode(message)}");
}
onResume: (Map<String, dynamic> message) async {
Log.d("onResume: ${jsonEncode(message)}");
},
onLaunch: (Map<String, dynamic> message) async {
Log.d("onLaunch: ${jsonEncode(message)}");
}
);
...
The console:
This message is print only when I receive the notification with app open or when I open the app after receive with app closed.
flutter: onMessage: {"collapse_key":"4cH4++Z1SUoDiUf9+l9DKFX/sc=","from":"50068760310"}
Additional context
I use AdminSDK for PHP for real use and the payload includes android specific data, but I tested on Postman to make sure the problem is not there.
The problem is occurring on production with all users I have checked (TestFlight Beta).
On Android it is working as expected.
If I send just data
the app continues receiving only when the app is on foreground.
Example
{
"data": {
"title": "Title test",
"body": "Body message"
},
"condition": "'match_1474' in topics"
}
The expected behaviour here is to receive the message in background executing immediately onMessage
when it's not killed, but this happens only when app opens.
flutter doctor -v
[✓] Flutter (Channel stable, v1.17.4, on Mac OS X 10.15.3 19D76, locale pt-BR)
• Flutter version 1.17.4 at /Users/fernando/Apps/flutter
• Framework revision 1ad9baa8b9 (10 days ago), 2020-06-17 14:41:16 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/fernando/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.8.4
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.45.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.10.2
[✓] Connected device (1 available)
• iPhone ... • ios • iOS 13.5.1
• No issues found!
pubspeck.yml dependencies
dependencies:
flutter:
sdk: flutter
json_annotation: ^3.0.1
jaguar_orm: ^2.2.7
jaguar_query_sqflite: ^2.2.11
device_info: ^0.4.2+4
rxdart: ^0.22.2
bloc_pattern: ^2.3.2
dio: ^3.0.1
intl: ^0.16.0
sprintf: ^4.0.2
firebase_messaging: ^6.0.16
flutter_local_notifications: 1.4.3
shared_preferences: ^0.5.6+1
package_info: ^0.4.1
mask_text_input_formatter: ^1.0.6
admob_flutter: ^0.3.4
archive: ^2.0.11
appsflyer_sdk: ^5.2.0+1
barcode_scan: ^1.0.0
cached_network_image: ^2.0.0
charts_flutter: ^0.8.1
configurable_expansion_tile: ^1.0.0
country_pickers: ^1.3.0
cupertino_icons: ^0.1.3
data_tables: ^1.0.3
date_range_picker: ^1.0.5
flare_flutter: ^1.0.2
fl_chart: ^0.9.4
flutter_cupertino_localizations: ^1.0.1
flutter_slidable: ^0.5.3
font_awesome_flutter: ^8.5.0
image_picker: ^0.6.3+4
path_provider: ^1.6.8
provider: ^2.0.0
pretty_qr_code: ^1.0.1
share: ^0.6.3+6
sqflite: ^1.2.0
url_launcher: ^5.2.7
webview_flutter: ^0.3.15+1
google_sign_in: ^4.5.1
flutter_svg: ^0.17.3+1
flutter_localizations:
sdk: flutter