【发布时间】:2018-11-17 05:31:56
【问题描述】:
我的项目有问题。我正在使用 edujugon 推送通知来推送我的应用程序的推送通知,我成功地为 android、ios 设备创建了带有标题、正文的推送通知。但是当我将通知集成到我的网络设备中时,它不会显示标题和正文,而是显示the site is upgrated in backend。另外我想在我的网络通知中设置一个 url。但是不知道怎么弄。
这是我的代码
public static function sendPushNotification($devices, $pushData, $partner = false) {
$android = $devices->where('type', 2)->pluck('token')->all();
if (!empty($android)) {
$push = new PushNotification('fcm');
$push->setMessage(
[
'data' => $pushData,
]
)
->setDevicesToken($android)
->send();
}
$ios = $devices->where('type', 1)->pluck('token')->all();
if (!empty($ios)) {
$push = new PushNotification('apn');
$feedback = $push->setMessage(
[
'aps' => [
'alert' => [
'title' => $pushData['title'],
'body' => $pushData['body'],
],
'sound' => 'default',
'badge' => 1
],
'data' => $pushData
]
)->setDevicesToken($ios)->send()->getFeedback();
}
$web = $devices->where('type', 3)->pluck('token')->all();
if (!empty($web)) {
$push = new PushNotification('fcm');
$push->setMessage($pushData)->setDevicesToken($web)->send();
}
}
而我的推送数据是
$pushData = [
'title' => 'Test',
'body' => 'Test',
];
请帮我解决这个问题
【问题讨论】:
标签: android ios laravel push-notification web-push