本地通知
使用 flutter_local_notification 實作,細節可參考原專案
注意
若未設定此頁面會影響以下功能
- 使用到 NotifcationUtils 的功能
- 課表骨架 中的上課提醒
限制#
目前只支援 Android 、 iOS 、 macOS 系統,並有以下限制
- Android 4.1+. 使用 NotificationCompat APIs 所以能跑在較舊的 Android 裝置
- iOS 8.0+. iOS 10 以下使用 UILocalNotification APIs. iOS 10 以上(包含)使用 UserNotification APIs (aka the User Notifications Framework)
- macOS 10.11+. 在 macOS 10.14 以下使用 NSUserNotification APIs 在 macOS 10.14 以下使用 UserNotification APIs (aka the User Notifications Framework)
設定#
Android#
自 flutter_local_notification v3.0.1+4 以後不需在專案中的 android/app/scr/main/AndroidManifest.xml 設定原生通知設定
更多 AndroidManifest.xml 設定 可參考
在 app/scr/main/res/drawable 加入 ic_stat_name.png,此圖是在通知顯示時在狀態列(status bar)顯示的圖案
iOS#
在 Runner 中的 AppDelegate.m/AppDelegate.swift
加入下列程式碼在 didFinishLaunchingWithOptions 方法下
Objective-C:
AppDelegate.m
Swift:
AppDelegate.swift
開啟 Xcode 在 Runner 中的 Signing & Capabilities 加入 Push Notification 的權限
macOS#
開啟 Xcode 在 Runner 中的 Signing & Capabilities 加入 Push Notification 的權限