gpt4 book ai didi

dart - 当应用程序关闭时,我如何在 flutter 中使用来自 sqlite 数据的本地通知

转载 作者:IT王子 更新时间:2023-10-29 06:57:46 25 4
gpt4 key购买 nike

后台处理的Flutter问题

How to show local notification from sqlite while app is closed in flutter?

最佳答案

尝试 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');
}

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

关于dart - 当应用程序关闭时,我如何在 flutter 中使用来自 sqlite 数据的本地通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55242780/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com