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.
설치
설치AI-assisted 설정을 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 Capgo 스킬을 추가하려면 다음 명령어를 사용하세요:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins다음 명령어를 사용하여 다음 프롬프트를 사용하세요:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-firebase-messaging` plugin in my project.만약 Manual Setup을 선호한다면, 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래에 플랫폼에 따라 설명된 지침을 따르세요:
bun add @capgo/capacitor-firebase-messagingbunx cap syncimport { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';API 개요
Section titled “API 개요”checkPermissions
Section titled “checkPermissions”푸시 알림을 받기 위해 권한을 확인합니다.
켜짐 안드로이드안드로이드 13 이상에서만 이 메서드를 호출해야 합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.checkPermissions();requestPermissions
Section titled “requestPermissions”푸시 알림을 받기 위해 권한을 요청합니다.
On 안드로이드, 이 메서드는 Android 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이라는 제목의 섹션푸시 알림을 받을 수 있도록 앱을 등록합니다. 푸시 메시지를 해당 Messaging 인스턴스로 보내기에 사용할 수 있는 FCM 토큰을 반환합니다.
이 메서드는 또한 FCM 자동 초기화를 재 활성화합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.getToken();deleteToken
__CAPGO_KEEP_1____CAPGO_KEEP_2__
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.deleteToken();getDeliveredNotifications
__CAPGO_KEEP_3____CAPGO_KEEP_4__
__CAPGO_KEEP_5__
__CAPGO_KEEP_6__
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.getDeliveredNotifications();removeDeliveredNotifications
__CAPGO_KEEP_7____CAPGO_KEEP_8__
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
Android 앱에서만 사용 가능합니다. (__CAPGO_KEEP_0__ 26+).알림 채널을 만들세요.
SDK 26+ 버전의 Android 앱에서만 사용 가능합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.createChannel({} as CreateChannelOptions);deleteChannel
Android 앱에서만 사용 가능합니다. (__CAPGO_KEEP_0__ 26+).알림 채널을 삭제하세요.
SDK 26+ 버전의 Android 앱에서만 사용 가능합니다.
import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';
await FirebaseMessaging.deleteChannel({} as DeleteChannelOptions);listChannels
Android 앱에서만 사용 가능합니다. (__CAPGO_KEEP_0__ 26+).알림 채널 목록을 확인하세요.
SDK 26+ 버전의 Android 앱에서만 사용 가능합니다.
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
제목: RemoveDeliveredNotificationsOptionsexport interface RemoveDeliveredNotificationsOptions { /** * @since 0.4.0 */ notifications: Notification[];}SubscribeToTopicOptions
제목: SubscribeToTopicOptionsexport interface SubscribeToTopicOptions { /** * The name of the topic to subscribe. * * @since 0.2.2 */ topic: string;}UnsubscribeFromTopicOptions
제목: UnsubscribeFromTopicOptionsexport interface UnsubscribeFromTopicOptions { /** * The name of the topic to unsubscribe from. * * @since 0.2.2 */ topic: string;}CreateChannelOptions
제목: CreateChannelOptionsexport type CreateChannelOptions = Channel;DeleteChannelOptions
제목: DeleteChannelOptionsexport interface DeleteChannelOptions { /** * The channel identifier. * * @since 1.4.0 */ id: string;}ListChannelsResult
제목: ListChannelsResultexport 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 키의 구현 세부 사항에 대해 기기 기기의 구현 세부 사항에 대해, 패키지 패키지의 구현 세부 사항에 대해.