Can't Send Firebase Notification Via Android But It Works Via Curl

- 1 answer

I am trying to send a push notification from one device to another using Firebase (they are two different projects). I am calling the API via okhttp3 library using POST. If I try it using curl the notification can be sent but via android I got the following error:


Is there some metadata sent with the rest call in Android? How can I sent

this is the curl call (that works fine)

curl -H "Content-type: application/json" -H "Authorization:key=AXXXXX" -X POST -d '{"data":{"info":"abc"},"to":"DEV-TOKEN-XXX"}'

in Android I just replicate the same scenario setting header, body ecc with okhttp3



It worked when I used the "Legacy server key" within Android making a rest call. But with curl I use the "Server key" and it works fine. Don't know why.