简体   繁体   中英

Open app on firebase notification received in flutter

I want to open the application automatically when a firebase notification is received, without user interaction. means when my application is killed or in the background and when the user receives a firebase notification the application should open automatic without user interaction or clicking on the notification is this possible in the flutter

I want to add this feature in the video calling application that when I receive a notification the call screen with accept reject button should render and I also want to add the autoanswer feature in it.

yes, obviously it's possible

u can do like this

demo video link : click here for watch video

Future<void> _showNotification() async {
    const AndroidNotificationDetails androidPlatformChannelSpecifics =
        AndroidNotificationDetails(
      'your channel id',
      'your channel name',
      channelDescription: 'your channel description',
      importance: Importance.max,
      priority: Priority.high,
      icon: '@mipmap/ic_launcher',
      // playSound: false,
    );
    const NotificationDetails platformChannelSpecifics = NotificationDetails(
      android: androidPlatformChannelSpecifics,
    );
    await flutterLocalNotificationsPlugin.show(
      0,
      'plain title',
      'plain body',
      platformChannelSpecifics,
      payload: 'item x',
    );
  }

您可以在 Android 中实现这一点,但目前在 iOS 中是不可能的,对于 android,它的全屏意图通知和对于 iOS,您可以做的大多数事情是在收到通知时设置自定义铃声,您可以使用下面提到的库进行大部分您的通知需求:- pub.dev/packages/flutter_local_notifications

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM