728x90

1. 구글에 떠돌아 다니는 fcm 소스를 적용했다.

2. firebase에서 테스트 메세지를 보냈다.

- 된다. 메세지도 잘 왔다.

3. postman으로 보낸다.

- 결과는 된다고 나오지만, 메세지는 안왔다.

 

찾아본 결과. 보내는 model이 내 것과 달랐다. 아래 소스로 수정.

data class NotificationBody(
    val to: String,
    val data: DataFormat,
    val notification: NotificationData,
)
{
    data class NotificationData(
        val title: String,
        val userId : String,
        val body: String
    )

    data class DataFormat(
        val KEY: String= "VALUE"
    )
}

- 된다. 알림도 메세지도 잘 온다.

4. 끝.

참고: 

https://devwooks.tistory.com/61

728x90
반응형

'Android Studio' 카테고리의 다른 글

[kotlin] retrofit2 : Failed to connect to 어쩌구  (0) 2023.02.07
ActionBar 없애기  (0) 2022.07.02
Splash 화면 만들기.  (0) 2022.07.02

+ Recent posts