Skip to content

Latest commit

 

History

History
54 lines (48 loc) · 1.71 KB

fcm.md

File metadata and controls

54 lines (48 loc) · 1.71 KB

Flutter FCM

firebase_messaging

iOS

Setup

  1. 創建 Firebase 專案
  2. GoogleService-Info.plist 放到 Runner (通常情況)
  3. 上傳 APNs
  4. XCode -> Runner -> Signing & Capability -> 新增 Push NotificationsBackground Modes (有兩個選項要打勾)
  5. 配置 info.plist

Android

Setup

  1. 創建 Firebase 專案
  2. google-services.json 放到 android/app (通常情況)
  3. android/app/src/main/AndroidManifest.xml 新增
        <intent-filter>
            <action android:name="FLUTTER_NOTIFICATION_CLICK" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
  4. android/build.gradle
        buildscript {
            dependencies {
                // ... other dependencies
                classpath 'com.google.gms:google-services:4.3.3' // 新增這一行 版本找最新的
            }
        }
  5. android/app/build.gradle
        apply plugin: 'com.android.application'
        apply plugin: 'com.google.gms.google-services'   // 新增這一行
    
    

Flutter

// 待補