Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
169 views
in Technique[技术] by (71.8m points)

Data array to send Push Notification in project PHP for android / ios

Notifications are sent, no problem mais I wish to have a badge on the notifications it is never used, I went through all the firebase documentation nothing to do. As is the keyword field.

Package used : edujugon/push-notification:4.5

    $devices[] = $deviceData['id'];

    $push = new PushNotification('fcm');
    $push->setMessage([
        'notification' => [
            'title' => $this->title,
            'body' => $this->body,
            'badge' => $this->badge,
        ],
    ])
        ->setApiKey($this->apiKeyFirebase)
        ->setDevicesToken($devices)
        ->send();

With this array sent, I am not receiving the notification under IOS, so the feedback from the ios server tells me that the notification has been sent, there must be a problem with the keys to my array that I am sending, I don’t haven't found, would anyone know?

    $devices[] = $deviceData['id'];

    $push = new PushNotification('apn');
    $push->setMessage([
        'aps' => [
            'alert' => [
                'title' => $this->title,
                'body' => $this->body,
            ],
            'badge' => $this->badge,
        ],
    ])
        ->setConfig($this->getConfig())
        ->setDevicesToken($devices)
        ->send();
question from:https://stackoverflow.com/questions/66066374/data-array-to-send-push-notification-in-project-php-for-android-ios

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Yes, the feedback :

object(stdClass)#157 (3) {
  ["success"]=>
  int(1)
  ["failure"]=>
  int(0)
  ["tokenFailList"]=>
  array(0) {
  }
}

It tells me sucess true but i am not getting the notification on ios, it is not visible


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...