메인 콘텐츠로 건너뛰기

가이드

알림에 대한 튜토리얼

Capacitor-notifications를 사용하여 capgo에서 사용자 조회, 배지, 전면/열기 추적, 배경 콜백 및 무음 capacitor 실시간 업데이트 확인을 위한 네이티브 iOS 및 Android 푸시 알림을 보냅니다.

이 플러그인은 Capgo 알림 PIPELINE을 위한 것입니다. Capgo은 플랫폼 인증서 메타데이터 및 캠페인 제어 데이터를 Postgres에 저장하며, 활성 장치 상태 및 전달 이벤트는 __CAPGO_KEEP_2__ Analytics Engine에 기록됩니다.

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-notifications를 사용하여 __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

__CAPGO_KEEP_0__

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 설정

켜기 푸시 알림 페이지/영역: Capgo 마케팅 웹사이트. 역할: 짧은 UI 레이블 또는 네비게이션 아이템. 메시지 키 `push_notifications` (푸시 알림). 그리고 페이지/영역: Capgo 마케팅 웹사이트. 역할: 짧은 UI 레이블 또는 네비게이션 아이템. Seen in: 페이지 trust.astro. 메시지 키 `and` (그리고).

배경 모드 > Remote notifications > 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)
}

안드로이드 설정

실행 npx cap sync androidAndroid 플랫폼 인증 정보를 Capgo 에서 설정하고 Android 13 이상에서 알림 권한을 요청한 후 Google Play 서비스가 있는 장치 또는 에뮬레이터에서 테스트하세요.

디버깅 체크리스트

  • 실행 npx @capgo/cli@latest notifications setup com.example.app __CAPGO_KEEP_0__ 에서 외부 고객 ID로 검색하는 수신자를 찾으세요. capacitor.config.*.
  • Search the recipient in Capgo by external customer ID.
  • 또는 android 확인 ios 임시 리스너를 추가하세요.
  • 그리고 registrationChanged, notificationReceived, notificationOpened, and backgroundNotification.
  • 대시보드에서 테스트 알림을 보내세요.
  • 대기 중인, 전송된, 수신된, 열린 이벤트의 통계를 확인하세요.
  • 잠재 업데이트를 확인하기 위해 @capgo/capacitor-updater 설치되어야 하고 autoUpdater 활성화되어야 합니다.

전체 참조

Keep going from Using @capgo/capacitor-notifications

Capacitor-notifications를 사용 중이라면 Using @capgo/capacitor-notifications 자연스러운 푸시 메시징을 계획하고 @capgo/capacitor-notifications implementation 세부 정보를 위해 Debugging 문제 해결을 위해 @capgo/capacitor-updater silent 업데이트를 확인하기 위해, Capgo Plugin Directory 기타 네이티브 플러그인