有没有办法跟踪自 Flutter 中关闭对话消息以来的天数?

波莉

我希望每月向用户显示一次对话消息。如果用户关闭该消息,那么我将重新启动计时器并在 30 天后显示它。

我查看了各种软件包,例如为我的应用评分,它跟踪最少天数,但这仅适用于应用评分,而不适用于通用对话框消息。

我希望该对话框在首次启动时显示,然后在消息被取消后每 30 天显示一次。

F-1

从 DateTime 类开始捕获对话框显示的时间

var now = new DateTime.now();

您可以使用具有调度功能的flutter_local_notifications

var scheduledNotificationDateTime =
        new DateTime.now().add(new Duration(days: 30));
var androidPlatformChannelSpecifics =
    new AndroidNotificationDetails('your other channel id',
        'your other channel name', 'your other channel description');
var iOSPlatformChannelSpecifics =
    new IOSNotificationDetails();
NotificationDetails platformChannelSpecifics = new NotificationDetails(
    androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.schedule(
    0,
    'scheduled title',
    'scheduled body',
    scheduledNotificationDateTime,
    platformChannelSpecifics);

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

有没有办法限制Flutter中的堆栈跟踪信息

有没有办法用Flutter打印控制台消息?

有没有办法减少Flutter中NavigationRail中每个元素的高度?

有没有办法在flutter中打开其他应用程序

有没有办法在 Flutter 的文本字段中显示条形码值?

有没有办法在Flutter中扫描条形码?

有没有办法在 Flutter 中的 onPressed() 事件上切换相机?

有没有办法在 Flutter/Dart 中添加导航路线以列出?

有没有办法在Flutter中的多个PageRoutes中使用InheritedWidget?

有没有办法在flutter中解析用javascript创建的html?

有没有办法从Flutter中的Future函数获取反馈

有没有办法在flutter中更改版本代码

有没有办法在flutter中向DropdownButton添加标签?

有没有办法在Flutter中以小写字母显示文本?

有没有办法在 Flutter 中无需注册就可以保存用户的数据?

有没有办法解决我在flutter中升级firebase后面临的问题

有没有办法以编程方式更改 Flutter TextTheme 中的属性值?

有没有办法在flutter中从firestore加载图像?

有没有办法从 Firefox Mobile 上的这个 flutter webapp 中删除这个空格?

有没有办法在flutter的SQLite表中添加大列表项?

有没有办法使用flutter防止IOS中的屏幕截图?

有没有办法使用 Dart/Flutter 访问 ForEach 中的索引/键

有没有办法在 Flutter Web 中创建和读取 cookie?

有没有办法在不使用 Flutter 中的 Mock 类扩展的情况下模拟对象?

有没有办法限制导航堆栈在Flutter App中可以维护的页面数?

有没有办法使用sqflite在flutter应用程序中检查数据库版本?

有没有办法在 vscode/visual studio code flutter 中自动填充所需的类/小部件属性?

Flutter:-有没有办法自定义列表构建器中每个扩展图块的输出?

有没有办法将图像从本地存储加载到Flutter中的CircleAvatar小部件的backgroundImage属性?