Flutterfire: [firebase_messaging] Fatal: failed to find callback

Created on 14 May 2020  路  9Comments  路  Source: FirebaseExtended/flutterfire

onLaunch, onResume are not working after update flutter 1.17.1 stable.
when tap notification, show error.
Fatal: failed to find callback.

Most helpful comment

same here

All 9 comments

Same error here!

Hi @YeomDongUk
can you please provide your flutter doctor -v ,
your flutter run --verbose,
your pubspec.yaml
and a reproducible minimal code sample.
Thank you

same here

釀夅叧釀忈叧釀呩叺釂剦釁a喓 2020-05-25 釀嬦叐釀掅叜 2 58 28
it is result of flutter doctor -v.
釀夅叧釀忈叧釀呩叺釂剦釁a喓 2020-05-25 釀嬦叐釀掅叜 2 59 50

Hi @YeomDongUk
thank you for your doctor
could you please provide the remaining info listed above
Please refrain from posting pictures if not necessary.
Thank you

釀夅叧釀忈叧釀呩叺釂剦釁a喓 2020-05-29 釀嬦叐釀掅叜 5 16 12
it is my pubspec.yaml

Hi @YeomDongUk
could you please provide
a reproducible minimal code sample.

Please refrain from posting pictures if not necessary.

Thank you

void main() async {
WidgetsFlutterBinding.ensureInitialized();
AppConfig.init();
FirebaseMessage.init();
await LocalNotification.init();
Analytics.init();
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle.dark.copyWith(
statusBarColor: Colors.black,
statusBarIconBrightness: Brightness.light,
statusBarBrightness: Brightness.light,
),
);
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
runZoned(() => runApp(MyApp()), onError: (error, stackTrace) async {
Logger().e(error.toString());
await FlutterCrashlytics()
.reportCrash(error, stackTrace, forceCrash: false);
});
}
class FirebaseMessage {
static void init() {
if (instance == null) {
_instance = FirebaseMessage();
if (instance._firebaseMessaging == null) {
instance._firebaseMessaging = FirebaseMessaging();
instance._firebaseCloudMessagingListen();
}
}
}

void configure(String userId) {
try {
instance.firebaseMessaging.configure(
onMessage: (Map fcm) async {
Logger().i("onMessage: $fcm");
Map data = Map.from(fcm);
if (fcm['data'] != null) data = Map.from(fcm['data']);
switcher(
clickAction: data["click_action"],
callback: () =>
LocalNotification.instance.onFeedback(fcm: data, userId: userId),
);
}, onLaunch: (Map fcm) async {
Logger().i("onLaunch: $fcm");
Map data = Map.from(fcm);
if (fcm['data'] != null) data = Map.from(fcm['data']);
switcher(
clickAction: data["click_action"],
callback: () => goFeedbackPage(
lectureId: data['lectureId'],
userId: userId,
),
);
}, onResume: (Map fcm) async {
Logger().i("onResume: $fcm");
Map data = Map.from(fcm);
if (fcm['data'] != null) data = Map.from(fcm['data']);
switcher(
clickAction: data["click_action"],
callback: () => goFeedbackPage(
lectureId: data['lectureId'],
userId: userId,
),
);
});
} catch (error) {
Logger().e(error);
// throw Exception(error);
}
}
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
FirebaseMessage.instance.configure(user.authId);
return ....;
}
}
I can receive onMessage but can't not receive onLaunch and onResume. This happens only on Android.

Hi there,

Is this issue resolved. I am also facing same issue on Android. onLaunch and onResume are not getting called. Can anyone help me here?

Was this page helpful?
0 / 5 - 0 ratings