메인 콘텐츠로 건너뛰기
플러그인으로 돌아가기
@capgo/capacitor-notifications
튜토리얼
@capgo/capacitor-notifications

알림

Capgo에서 사용자 조회, 배지, 통계 및 무음 업데이트 확인을 포함한 네이티브 iOS 및 Android 푸시 알림을 보냅니다.

Capacitor __CAPGO_KEEP_0__로 native iOS 및 Android 푸시 알림을 보내기

Capacitor __CAPGO_KEEP_0__는 사용자 조회, 배지, 전면/열기 추적, 배경 콜백 및 무음 __CAPGO_KEEP_1__ 실시간 업데이트 확인을 지원합니다.

Using @capgo/capacitor-notifications

Send native iOS and Android push notifications from Capgo with user lookup, badges, foreground/open tracking, background callbacks, and silent Capgo live-update checks.

The plugin is built for the Capgo notification pipeline. Capgo stores platform credential metadata and campaign control data in Postgres, while active device state and delivery events are written to Cloudflare Analytics Engine.

Capacitor __CAPGO_KEEP_0__ __CAPGO_KEEP_1__을 사용하여 가이드된 설정을 사용하세요:

Use the Capgo CLI for a guided setup:

npx @capgo/cli@latest notifications setup com.example.app

수동 설치:

npm install @capgo/capacitor-notifications @capgo/capacitor-updater
npx cap sync

설정

import { CapgoNotifications } from '@capgo/capacitor-notifications'

await CapgoNotifications.configure({
  appId: 'com.example.app',
  autoUpdater: true,
  updateInstallMode: 'next',
})

등록된 사용자 등록

Mint identityProof 백엔드에서 POST /notifications/recipients/proof그런 다음 로그인 성공 후 장치 등록

await CapgoNotifications.register({
  externalId: 'customer-user-123',
  identityProof,
  tags: ['paid'],
  attributes: { plan: 'team' },
  consent: true,
})

이벤트를 듣다

await CapgoNotifications.addListener('notificationReceived', (notification) => {
  console.log('Received', notification)
})

await CapgoNotifications.addListener('notificationOpened', (event) => {
  console.log('Opened', event.notification.id)
})

await CapgoNotifications.addListener('backgroundNotification', async (event) => {
  try {
    console.log('Background payload', event.notification.data)
  } finally {
    await event.finish()
  }
})

iOS 설정

푸시 알림 활성화 배경 모드 > 원격 알림 그리고 배경 모드 > 원격 알림 Xcode에서 실행합니다.

원격 알림을 전달하는 데 사용합니다. ios/App/App/AppDelegate.swift:

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    NotificationCenter.default.post(name: Notification.Name("CapgoNotificationsRemoteNotification"), object: userInfo)
    completionHandler(.newData)
}

Android 설정

실행 npx cap sync androidAndroid 플랫폼 인증 정보를 Capgo에 입력하고, Android 13 이상에서 알림 권한을 요청하고, Google Play 서비스가 있는 기기나 에뮬레이터에서 테스트합니다.

디버깅 체크리스트

  • 실행 npx @capgo/cli@latest notifications setup com.example.app __CAPGO_KEEP_0__에 있는 폴더에서 capacitor.config.*.
  • Capgo에서 외부 고객 ID로 검색한 수신자를 확인합니다.
  • 디바이스가 플랫폼을 지원하는지 확인합니다. android 또는 ios 디바이스가 플랫폼을 지원하는지 확인합니다. 또는
  • 임시 리스너를 추가합니다. registrationChanged, notificationReceived, notificationOpened, 및 backgroundNotification.
  • 대시보드에서 테스트 알림을 보내세요.
  • 대기 중인, 전송된, 수신된 및 열린 이벤트의 통계를 확인하세요.
  • silent 업데이트 확인을 위해, @capgo/capacitor-updater 설치되어야 하는지 확인하고 autoUpdater 활성화되어야 하는지 확인하세요.

전체 참조

Using @capgo/capacitor 알림

이 기능을 사용 중이라면 Using @capgo/capacitor 알림 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__ 알림과 연결하여 자세한 구현 정보를 @capgo/capacitor 알림에서 확인할 수 있습니다. 디버깅 문제 해결을 위해 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__ 업데이터 @capgo/capacitor-updater __CAPGO_KEEP_0__ 플러그인 디렉토리 Capgo Plugin Directory @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-업데이터