Local Notification (Setting)

🔔 Local Notifications 사용해 보기

Local Notifications - 2(사용방법)
Local Notifications - 3(리스너)

Android

Version

compileSdkVersion 33
minSdkVersion 23
targetSdkVersion 32

AndroidMenifest.xml

project > android > app > src > main

  • Permission
  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-permission android:name="android.permission.WAKE_LOCK" />
  <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
  • 디바이스 잠금시 알림 ON
<activity
android:showWhenLocked="true"
android:turnScreenOn="true">
  • 디바이스 재부팅시 알림 스케줄링을 유지
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED"/>
        <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
        <action android:name="android.intent.action.QUICKBOOT_POWERON" />
        <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
    </intent-filter>
</receiver>
  • 푸시 알림을 화면에 출력
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />

IOS

AppDelegate.swift

  • IOS Foreground 푸시 수신
if #available(iOS 10.0, *) {
    UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}

Library

flutter_local_notifications: ^12.0.2

profile
Flutter Developer

0개의 댓글