关闭应用程序后,如何在Flutter中使用来自sqlite数据的本地通知

时间:2019-03-19 13:59:58

标签: dart flutter

用于后台处理的抖动问题

  

在应用程序关闭时如何显示来自sqlite的本地通知?

1 个答案:

答案 0 :(得分:1)

尝试使用flutter_local_notifications中的代码段sample example app

  Future<void> _showNotification() async {
    var androidPlatformChannelSpecifics = AndroidNotificationDetails(
        'your channel id', 'your channel name', 'your channel description',
        importance: Importance.Max, priority: Priority.High, ticker: 'ticker');
    var iOSPlatformChannelSpecifics = IOSNotificationDetails();
    var platformChannelSpecifics = NotificationDetails(
        androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
    await flutterLocalNotificationsPlugin.show(
        0, 'plain title', 'plain body', platformChannelSpecifics,
        payload: 'item x');
  }

它还可以选择安排通知,并根据单击的通知进行路由。

相关问题