Getting Started
설치 명령어와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 프롬프트 복사
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-firebase-messaging`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/firebase-messaging/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
설치
설치 섹션bun add @capgo/capacitor-firebase-messagingbunx cap syncimport
__CAPGO_KEEP_0__ importimport { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';API 개요
API 개요checkPermissions
__CAPGO_KEEP_0__ checkPermissions__CAPGO_KEEP_0__ push 알림 수신 권한 확인
켜짐 안드로이드안드로이드 13 이상에서만 이 메서드를 호출해야 합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.checkPermissions();requestPermissions
__CAPGO_KEEP_0__ requestPermissions__CAPGO_KEEP_0__ push 알림 수신 권한 요청
On Android 이상에서만 호출해야 합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.requestPermissions();isSupported
isSupported라는 제목의 섹션필요한 모든 API가 존재하는지 확인합니다.
항상 true Android와 iOS에서.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.isSupported();getToken
getToken이라는 제목의 섹션푸시 알림을 받을 수 있도록 앱을 등록합니다. 푸시 메시지를 해당 Messaging 인스턴스로 전송할 수 있는 FCM 토큰을 반환합니다.
이 메서드는 FCM 자동 초기화를 다시 활성화합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.getToken();deleteToken
삭제 토큰FCM 토큰을 삭제하고 앱을 등록해 푸시 알림을 받지 않도록 합니다. 예를 들어, 사용자가 로그아웃 할 때 호출할 수 있습니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.deleteToken();getDeliveredNotifications
받은 알림 가져오기알림 화면에서 보이는 알림 목록을 가져옵니다.
주의: 이 메서드는 모든 전달된 알림, 즉 로컬 알림 및 FCM 알림을 모두 반환합니다. Android에서는 FCM 알림의 데이터 필드가 포함되지 않습니다.
클립보드 복사
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.getDeliveredNotifications();removeDeliveredNotifications
알림 화면에서 특정 알림을 삭제합니다.클립보드 복사
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.removeDeliveredNotifications({} as RemoveDeliveredNotificationsOptions);removeAllDeliveredNotifications
__CAPGO_KEEP_0____CAPGO_KEEP_1__
__CAPGO_KEEP_2__
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.removeAllDeliveredNotifications();subscribeToTopic
__CAPGO_KEEP_4____CAPGO_KEEP_5__
__CAPGO_KEEP_6__
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.subscribeToTopic({} as SubscribeToTopicOptions);unsubscribeFromTopic
__CAPGO_KEEP_8____CAPGO_KEEP_9__
__CAPGO_KEEP_10__
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.unsubscribeFromTopic({} as UnsubscribeFromTopicOptions);createChannel
createChannel 섹션알림 채널을 생성합니다.
Android (SDK 26+) 전용입니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.createChannel({} as CreateChannelOptions);deleteChannel
deleteChannel 섹션알림 채널을 삭제합니다.
Android (SDK 26+) 전용입니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.deleteChannel({} as DeleteChannelOptions);listChannels
listChannels 섹션사용 가능한 알림 채널 목록을 표시합니다.
Android (SDK 26+) 전용입니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.listChannels();타입 참조
타입 참조 섹션PermissionStatus
권한 상태 섹션export interface PermissionStatus { /** * @since 0.2.2 */ receive: PermissionState;}IsSupportedResult
지원 여부 결과 섹션export interface IsSupportedResult { /** * @since 0.3.1 */ isSupported: boolean;}GetTokenOptions
토큰 가져오기 옵션 섹션export interface GetTokenOptions { /** * Your VAPID public key, which is required to retrieve the current registration token on the web. * * Only available for Web. */ vapidKey?: string; /** * The service worker registration for receiving push messaging. * If the registration is not provided explicitly, you need to have a `firebase-messaging-sw.js` at your root location. * * Only available for Web. */ serviceWorkerRegistration?: ServiceWorkerRegistration;}GetTokenResult
토큰 가져오기 결과 섹션export interface GetTokenResult { /** * @since 0.2.2 */ token: string;}GetDeliveredNotificationsResult
배달된 알림 결과 섹션export interface GetDeliveredNotificationsResult { /** * @since 0.2.2 */ notifications: Notification[];}RemoveDeliveredNotificationsOptions
제거된 알림 옵션 제거export interface RemoveDeliveredNotificationsOptions { /** * @since 0.4.0 */ notifications: Notification[];}SubscribeToTopicOptions
주제 구독 옵션export interface SubscribeToTopicOptions { /** * The name of the topic to subscribe. * * @since 0.2.2 */ topic: string;}UnsubscribeFromTopicOptions
주제 구독 취소 옵션export interface UnsubscribeFromTopicOptions { /** * The name of the topic to unsubscribe from. * * @since 0.2.2 */ topic: string;}CreateChannelOptions
채널 생성 옵션export type CreateChannelOptions = Channel;DeleteChannelOptions
채널 삭제 옵션export interface DeleteChannelOptions { /** * The channel identifier. * * @since 1.4.0 */ id: string;}ListChannelsResult
채널 목록 결과export interface ListChannelsResult { channels: Channel[];}TokenReceivedListener
TokenReceivedListener토큰 수신 이벤트를 받는 콜백
export type TokenReceivedListener = (event: TokenReceivedEvent) => void;실질적인 출처
실질적인 출처이 페이지는 플러그인의 src/definitions.ts공개 API이 업스트림에서 변경될 때 다시 싱크를 실행하세요.
Getting Started에서 계속
실질적인 출처Getting Started 계획 대시보드 및 __CAPGO_KEEP_0__ 운영을 위해 연결하세요. to plan dashboard and API operations, connect it with API 개요 API 개요 구현 세부 사항에 대해 소개 소개 구현 세부 사항에 대해 API 키 API 키 구현 세부 사항에 대해 장치 장치 구현 세부 사항에 대해, 그리고 패키지 패키지 구현 세부 사항에 대해.