简体   繁体   中英

Firebase cloud messaging works on console but not for FCM api

I've developed an iOS app through React-Native framework, which is integrated with Firebase Cloud Messaging. I've tested with Firebase Console for sending push notifications with token and it works like a charm!

But it isn't delivered when I send through FCM api and it even says successful .

Here is the curl statement I used for FCM api request.

curl -X "POST" "https://fcm.googleapis.com/fcm/send" \
     -H "Authorization: key=AAAAEqsrnAw:APA91bEwn7KNzpVJ27AzJtGHmUClDYO-k005OKiyIa1TQTWExl9wT6kfnmLP-7Q1ff5YrcqVuy8Wc-WCkDcTAusiIyt48-p8ui0WaTlavdwxCr9-HajWznnncXE32i8xEMGCstHHFWM_be16ZMuZ-AOaI88sDZSQJA" \
     -H "Content-Type: application/json" \
     -d $'{
  "notification": {
    "body": "Testing with direct FCM API",
    "title": "Test Message",
    "badge": "0",
    "sound": "default"
  },
  "priority": "high",
  "registration_ids": [
"eDi_iym1zNQ:APA91bEic3gyj93QIO7HYDLk0wfLjB1NKBdShrI8US4Keb66A5h5YUNg-wzGDEONK2-il_EfUceb0zGRblERaBrS_s3vVkfpzisuBI_D1OEZePFABIJ3l4sQW10fbKZs-tH20GVlHeSO"
  ]
}`

And the response is

{"multicast_id":6197584553577906730,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1554285189057616%491f0536491f0536"}]}

Server API KEY and token are correct and they work with Firebase console very well!

Please let me know what's wrong here.

Something went wrong. I was using old version of framework( react-native-firebase ) and upgrading framework solved the problem like a charm!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM