FCM 등록 절차 A에서 Z까지
FCM 등록 절차 처음과 끝.
FCM 등록 절차
1. APNs(Apple Push Notification Service) 설정
- Apple Developer (https://developer.apple.com) 로그인
- Certificates, Identifiers & Profiles의 Identifiers 클릭
- Identifiers의 ‘+’ 클릭
- App IDs 선택, Continue 클릭
- App 선택, Continue 클릭
- Description 입력, Bundle ID 입력, Continue 클릭
- 추가된 Identifier 선택
- Push Notifications 선택, Continue (Edit) 클릭
- Development SSL Certificate, Production SSL Certificate 2번 작업.
- Development SSL Certificate : Upload a Certificate Signing Request에서 [ext 1 키체인 만들기] 에서 제작된 키체인 업르드
- Production SSL Certificate : Upload a Certificate Signing Request에서 [ext 1 키체인 만들기] 에서 제작된 키체인 업르드
- Download 클릭, Development SSL Certificate APNs Certificate , Production SSL Certificate APNs Certificate 다운로드
- 다운로드 받은 파일 더블 클릭 (Keychain Access에 등록)
- Keychain Access에 등록된 인증서의 오른쪽 마우스 클릭 -> Export “xxxxx.xxxxx.xxxxx”… 선택
- Save As 확인, 저장위치 선택, File Format의 Personal Information Exchange (.p12) 선택, Save 클릭
2. Firebase 설정
- Firebase (https://firebase.google.com) 로그인
- Go to console 클릭
- 프로젝트 추가 클릭
- 프로젝트 이름 입력, 계속 클릭
- 계속 클릭
- 계정 선택, 프로젝트 만들기 클릭
- 생성된 프로젝트에서 flutter icon 클릭
- [ext 2 Flutter 앱에 Firebase 추가] 진행
- 생성한 프로젝트 선택
- 프로젝트 개요 -> 톱니바퀴 아이콘 -> 프로젝트 설정 클릭
- 클라우드 메시싱 선택
- Apple 앱 구성의 APN 인증 키 or APN 인증서중 선택후 처리 (APN 인증 키 사용 추천)
- APN 인증 키 : [ext 3 APN 인증 키] 에서 생성된 파일 (.p8) 업로드, 키 ID 입력, 팀 ID 입력
- APN 인증서 : APNs(Apple Push Notification Service)를 설정에서 생성된 파일 (.p12) 업로드
3. 프로젝트 Xcode 설정
- 프로젝트의 Runner.xcworkspace 선택
- Signing & Capabilities -> + apability 클릭
- Push Notifications 추가
- Background Modes 추가
- Background fetch 선택
- Remote notifications 선택
4. android/app/src/main/ AndroidManifest.xml 수정
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 권한 요청 -->
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
<!-- https://velog.io/@leedool3003/Flutter-FCM-Firebase-Cloud-Messagin-연동
<uses-permission android:name="android.permission.INTERNET"/>
<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" />
-->
<application
android:label="fcm_ios_fx"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- https://velog.io/@leedool3003/Flutter-FCM-Firebase-Cloud-Messagin-연동
android:showWhenLocked="true"
android:turnScreenOn="true"
-->
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<!-- Push 메시지의 중요도가 높다고 등록해 주어야 Push를 정상적으로 수신하는 것이 가능 -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="high_importance_channel" />
<!-- Push 메시지를 클릭하여 앱에 진입할 때에 메시지 안에 담겨있는 정보를 받기 위해 추가하여야 하는 태그 -->
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
5. Firebase FCM Test (Option)
- Firebase (https://firebase.google.com) 로그인
- Go to console 클릭
- 프로젝트 클릭
- Cloud Messaging 클릭
- 첫 번째 캠페인 만들기 클릭
- Firebase 알림 메시지 선택, 만들기 클릭
- 알림 제목 입력, 알림 텍스트 입력, 테스트 메시지 전송 클릭
- FCM 등록 토큰 추가에 FCM Token 입력 or 최근에 사용한 항목에서 선택, 테스트 클릭
Extra Jobs
[ext 1 키체인 만들기]
- Keychain Access 실행
- keychain Access -> Certificate Assistant -> Request a Certificate From a Certificate Authority… 클릭
- User Email Address 입력, Saved to disk 선택, Continue 클릭
- Save As 확인, 저장위치 선택, Save 클릭
[ext 2 Flutter 앱에 Firebase 추가]
- Firebase CLI 설치 및 로그인
- Flutter SDK 설치
- Flutter Project 생성
- 다음 클릭
- FlutterFire CLI 설치 및 실행
- Firebase에서 제시해준 내용을 참조하여 실행
- 다음 클릭
- Firebase 초기화 및 플러그인 추가
- Firebase에서 제시해준 내용을 참조하여 실행
[ext 3 APN 인증 키]
- Apple Developer (https://developer.apple.com/kr) 로그인
- Certificates, Identifiers & Profiles의 Keys 클릭
- Keys의 ‘+’ 클릭
- Key Name 입력, Apple Push Notifications service (APNs) 선택, Continue 클릭
- Save As 확인, 저장위치 선택, Save 클릭 (*.p8)
[ref] FCM 설정
Firebase
Flutter에서 Firebase 클라우드 메시징 클라이언트 앱 설정
백그라운드 앱에 테스트 메시지 보내기
Flutter 앱에서 메시지 수신
Flutter에서 주제 메시징
FlutterFire
FCM via APNs Integration
Blog
[Flutter / 플러터 ] 삽질은 그만, Firebase Messaging iOS 셋업
[Flutter] FCM, Firebase Cloud Messaging 연동
[iOS] FCM(Firebase Cloud Messaging) + APNs - 푸쉬 알림 등록 (2)
댓글남기기