push-notification - Flutter:即使应用关闭也会推送通知

标签 push-notification flutter apple-push-notifications android-notifications mobile-application

我已经构建了一个带有 Flutter 的应用程序,它就像一个提醒一样工作。
即使应用程序关闭,如何向用户显示通知?

最佳答案

对于提醒,我会推荐 Flutter Local Notifications Plugin .它有一个强大的调度API。来自本地通知的文档:

Scheduling when notifications should appear - Periodically show a notification (interval-based) - Schedule a notification to be shown daily at a specified time - Schedule a notification to be shown weekly on a specified day and time - Ability to handle when a user has tapped on a notification when the app is the foreground, background or terminated

对于推送通知,您可以使用 Firebase Cloud Messaging one signal插件或者您可以通过 platform-channels 本地实现

编辑:即使应用程序终止,您也可以根据特定条件触发通知。这可以通过在后台运行 dart 代码来实现。引用官方常见问题:

Can I run Dart code in the background of an Flutter app? Yes, you can run Dart code in a background process on both iOS and Android. For more information, see the Medium article Executing Dart in the Background with Flutter Plugins and Geofencing.

关于push-notification - Flutter:即使应用关闭也会推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53572110/

相关文章:

ios - 在 APNS 的推送通知中发送摄像头

ios - 如何在ios上获取所有收到的通知

flutter 间隔器与扩展

flutter - 如何将 DrawerHeader 的高度设置为与 AppBar 的高度精确一致

ios - 禁用特定时间间隔的推送通知 iOS

java - 苹果推送通知服务(APNS): Feedback Service Response has missing byte?

ios - 如何在多个 iOS 设备之间同步推送通知?

flutter - 从 Widget 或 Canvas 创建原始图像

Java 套接字和丢弃的连接

ios7 - UUIDString 的identifierForVendor 返回 null