How to implement firebase cloud messaging in server side?

后端 未结 4 1220
执笔经年
执笔经年 2021-02-08 09:19

After migrating to Firebase, i tested sending notification by using the firebase console it works fine, but i need a daily notification on a specific time so instead of using th

4条回答
  •  别那么骄傲
    2021-02-08 09:51

    Apart from changing the url to following:

    https://fcm.googleapis.com/fcm/send
    

    You also have to change the way you send request data:

     Content-Type:application/json
     Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
    
     {
       "to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...", // "to" replaces "registration_ids" of gcm in fcm
       "data" : {
       ...
      },
    }
    

    Check out this complete guide.

提交回复
热议问题