I\'m trying to use FCM messaging and keep getting this error.
E/FlutterFcmService( 3684): Fatal: failed to find callback
Below is the code I\'ve
You should declare a backgroundMessageHandler function that is outside a class or as a static function, in order to be reached from outside, and then you pass this function to fbm.configure:
Future myBackgroundMessageHandler(Map message) {
print('on background $message');
}
fbm.configure(
onMessage: (msg) {
print(msg);
return;
},
onLaunch: (msg) {
print(msg);
return;
},
onResume: (msg) {
print(msg);
return;
},
onBackgroundMessage: myBackgroundMessageHandler
);
Also open your_project_folder/android/app/source/AndroidManifest.xml and paste this XML code after existing intent-filter code of your main Activity:
The result will be similar to the following code: