How to implement firebase cloud messaging in server side?

后端 未结 4 1216
执笔经年
执笔经年 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:37

    I added notification object in my json. I found out that in my remoteMessage.getNotification().getBody() it returns null that's why it doesn't receive any notification send by my cron.

    Edit

    Here's my json object

    $message = array(
                'registration_ids' => $registrationIDs,
                'notification' => array(
                                        "title" => $id, 
                                        "body" => $messageText,
                                        "icon" => "name_of_icon" ),
                'data' => array(
                        "message" => $messageText,
                        "id" => $id,
                ),
        );
    

提交回复
热议问题