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 sync수입
수입import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';API 개요
API 개요checkPermissions
__checkPermissions____Capgo__ 푸시 알림 수신 권한 확인
켜짐 안드로이드13 이상의 안드로이드에서만 이 메서드를 호출해야 합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.checkPermissions();requestPermissions
'requestPermissions'라는 제목의 섹션푸시 알림을 받기 위해 권한을 요청합니다.
On 안드로이드13 이상의 안드로이드에서만 이 메서드를 호출해야 합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.requestPermissions();isSupported
'isSupported'라는 제목의 섹션필요한 모든 API가 존재하는지 확인합니다.
항상 반환 true 안드로이드와 iOS에서 동작합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.isSupported();getToken
getToken푸시 알림을 받기 위해 앱을 등록하세요. FCM 토큰을 반환하여 푸시 메시지를 해당 메시징 인스턴스로 전송할 수 있습니다.
이 메서드는 FCM 자동 초기화를 다시 활성화합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.getToken();deleteToken
deleteToken푸시 알림을 받지 않도록 앱을 등록 해제하세요. 예를 들어, 사용자가 로그아웃 할 때 호출할 수 있습니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.deleteToken();getDeliveredNotifications
getDeliveredNotifications알림 화면에서 표시되는 알림 목록을 가져옵니다.
주의: 이 메서드는 모든 전달된 알림을 반환하며, FCM 알림만 반환하지 않습니다.
안드로이드에서 FCM 알림의 데이터 field는 포함되지 않습니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.getDeliveredNotifications();removeDeliveredNotifications
제목 "removeDeliveredNotifications"특정 알림을 알림 화면에서 제거합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.removeDeliveredNotifications({} as RemoveDeliveredNotificationsOptions);removeAllDeliveredNotifications
제목 "removeAllDeliveredNotifications"모든 알림을 알림 화면에서 제거합니다.
주의: 이 기능은 모든 전달된 알림, 포함하여 로컬 알림을 제거합니다. FCM 알림만 제거하지 않습니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.removeAllDeliveredNotifications();subscribeToTopic
제목 "subscribeToTopic"배경에서 주제에 구독합니다.
안드로이드와 iOS에서만 사용 가능합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.subscribeToTopic({} as SubscribeToTopicOptions);unsubscribeFromTopic
“unsubscribeFromTopic” 제목의 섹션주제에서 자동으로 구독 해제합니다.
Android 및 iOS에서만 사용할 수 있습니다.
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
__CAPGO_KEEP_1____CAPGO_KEEP_2__
Only available for Android (SDK 26+).
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.listChannels();__CAPGO_KEEP_4__
__CAPGO_KEEP_5__PermissionStatus
Copy to clipboardexport interface PermissionStatus { /** * @since 0.2.2 */ receive: PermissionState;}IsSupportedResult
Copy to clipboardexport interface IsSupportedResult { /** * @since 0.3.1 */ isSupported: boolean;}GetTokenOptions
Copy to clipboardexport 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
GetTokenResult 섹션 제목export interface GetTokenResult { /** * @since 0.2.2 */ token: string;}GetDeliveredNotificationsResult
GetDeliveredNotificationsResult 섹션 제목export interface GetDeliveredNotificationsResult { /** * @since 0.2.2 */ notifications: Notification[];}RemoveDeliveredNotificationsOptions
RemoveDeliveredNotificationsOptions 섹션 제목export interface RemoveDeliveredNotificationsOptions { /** * @since 0.4.0 */ notifications: Notification[];}SubscribeToTopicOptions
SubscribeToTopicOptions 섹션 제목export interface SubscribeToTopicOptions { /** * The name of the topic to subscribe. * * @since 0.2.2 */ topic: string;}UnsubscribeFromTopicOptions
UnsubscribeFromTopicOptions 섹션 제목export interface UnsubscribeFromTopicOptions { /** * The name of the topic to unsubscribe from. * * @since 0.2.2 */ topic: string;}CreateChannelOptions
CreateChannelOptions 섹션 제목export type CreateChannelOptions = Channel;DeleteChannelOptions
DeleteChannelOptions 제목export interface DeleteChannelOptions { /** * The channel identifier. * * @since 1.4.0 */ id: string;}ListChannelsResult
ListChannelsResult 제목export interface ListChannelsResult { channels: Channel[];}TokenReceivedListener
TokenReceivedListener 제목토큰이 수신된 이벤트를 받는 콜백입니다.
export type TokenReceivedListener = (event: TokenReceivedEvent) => void;실제 데이터의 원천
실제 데이터의 원천이 페이지는 플러그인의 src/definitions.ts. upstream에서 변경된 API의 공개 버전을 다시 동기화할 때입니다.
Getting Started에서 계속 진행하세요
Getting Started에서 계속 진행하는 방법__CAPGO_KEEP_0__을 사용 중이라면 Getting Started API과 통합하여 API 개요 API 개요에서 구현 세부 정보를 확인하세요 __CAPGO_KEEP_0__ __CAPGO_KEEP_0__에서 구현 세부 정보를 확인하세요 API 키 API 키에서 구현 세부 정보를 확인하세요 장치 __CAPGO_KEEP_0__ 구현 세부 사항에 대한 Devices, 및 __CAPGO_KEEP_0__ 구현 세부 사항에 대한 Bundles,. __CAPGO_KEEP_0__ 페이지