카테고리 없음

FCM Cloud Messaging API(V1) 테스트

야라라라 2024. 8. 16. 15:10
반응형
SMALL

FCM 포스트맨으로 테스트 할때 기존에는

Headers 에 Authorization 에 서버키를 입력해 테스트 했었는데

 

 

이젠 Cloud Messaging API(V1) 를 사용해야 한다

 

앱쪽 코드는 변경할게 없고

 

1. Google Developers에 OAuth 2.0 Playground에 접속
https://developers.google.com/oauthplayground

 

OAuth 2.0 Playground

Request Body Manual entry Enter the data that will be added to the body of the request: File You may choose to send a file as part of the request. When both a file and manual content are provided both will be sent using a multipart request. You may send fi

developers.google.com

 

2. 아래 블로그 참고해서

https://velog.io/@thwjd9393/Android-FCM-전송-테스트with-Postman

 

Android FCM 전송 테스트with Postman

※ 패키지 이름 android studio 에서 만든 프로젝트 이름과 동일해야함1) 프로젝트 수준 build.gradle 2) 앱 수준 build.gradle3) FirebaseMessagingService를 상속받은 MyFirebaseMessagingService.c

velog.io

 

 

3. access token 값 얻기

 

4. 포스트맨에서 Headers - Authorization 에 Bearer 'access_token"  , Content-type 은 application/json

 

5. Body 는 raw 선택 후

{
"message": {
"token": "fcm 앱 토큰",
"notification": {
"body": "Body of Your Notification in data",
"title": "Title of Your Notification in data"
}
}
}

 

 

하면 테스트 발송 완료~

반응형
LIST