Untitled
unknown
plain_text
3 years ago
944 B
3
Indexable
Future<void> setupInteractedMessage() async { FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage? initialMessage) { if (initialMessage != null) { _handleMessage(initialMessage); } }); FirebaseMessaging.onMessageOpenedApp.listen(_handleMessage); FirebaseMessaging.onMessage.listen((RemoteMessage message) async { RemoteNotification? notification = message.notification; if(notification != null) { print(message.data); } LocalNotificationService.displayLocalNotification(message); }); } void _handleMessage(RemoteMessage message) { print(message.data) Navigator.push(context,MaterialPageRoute(builder: (context) => Screen2(messageData: message.data),),); } @override void initState() { super.initState(); LocalNotificationService.initialize(context); setupInteractedMessage(); }
Editor is loading...