Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _firebaseMessaging.configure(
- onMessage: (Map<String, dynamic> message) {
- print('on message $message');
- print(message['route']);
- globals.firebaseIn(message['route']);
- },
- onResume: (Map<String, dynamic> message) {
- print('on resume $message');
- globals.firebaseOut(message['route']);
- },
- onLaunch: (Map<String, dynamic> message) {
- print('on launch $message');
- globals.firebaseOut(message['route']);
- },
- );
- void firebaseIn(String route) {
- showNotificationWithDefaultSound(route);
- }
- Future onSelectNotification(String payload) async {
- router.navigateTo(currentContext, payload,
- transition: TransitionType.inFromRight,
- transitionDuration: const Duration(milliseconds: 500));
- }
- Future showNotificationWithDefaultSound(String route) async {
- var androidPlatformChannelSpecifics = new
- AndroidNotificationDetails(
- 'your channel id', 'your channel name', 'your channel description',
- importance: Importance.Max, priority: Priority.High);
- var iOSPlatformChannelSpecifics = new IOSNotificationDetails();
- var platformChannelSpecifics = new NotificationDetails(
- androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
- await flutterLocalNotificationsPlugin.show(
- 0,
- 'استطلاع جديد',
- 'لديك استطلاع جديد',
- platformChannelSpecifics,
- payload: route,
- );
- }
- void firebaseOut(String route) {
- router.navigateTo(currentContext, route,
- transition: TransitionType.inFromRight,
- transitionDuration: const Duration(milliseconds: 500));
- }
Add Comment
Please, Sign In to add comment