在android / ios项目PHP中发送推送通知的数据数组



通知发送了,没有问题的邮件,我希望在通知上有一个徽章,它从来没有使用过,我看了所有的firebase文档什么也没做。关键字字段也是如此。

使用的包: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();

这个数组发送,我没有收到IOS下的通知,所以IOS服务器的反馈告诉我通知已经发送,我发送的数组的键一定有问题,我还没有发现,有人知道吗?

$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();

是的,反馈:

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

它告诉我成功,但我没有收到ios上的通知,它是不可见的

使用library sly/notification-pusher,我收到了推送通知,但我没有标题:

$messages = [$this->body];
$params = ['title' => $this->title];
$pushNotificationService = new ApnsPushService(
$certificatePath, $passPhrase, PushManager::ENVIRONMENT_PROD
);
$response = $pushNotificationService->push($devices, $messages, [
'aps' => [
'alert' => [
'title' => $this->title,
'body' => $this->body,
],
'badge' => $this->badge,
]
]);

相关内容

  • 没有找到相关文章

最新更新