Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
282 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 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...