简体   繁体   English

Laravel推送通知:发送静默推送通知

[英]Laravel Push notifications: Send silent push notification

I am using this to send push notification to iOS and it is working fine except the fact that I don't know how to send a silent push using this package. 我正在使用iOS发送push notification ,除了我不知道如何使用此程序包发送静默推送外,它工作正常。 I have tried to send it like this: 我试图这样发送:

$payload = PushNotification::Message('', array(
                    'aps' => array(
                        'content_available' => 1,
                    ),
                    'data' => array(
                        'actionType' => $actionType
                    )
                ));

Sending empty string in the first param of ::Message , it does not show anything on mobile screen but it does produces the sound. ::Message的第一个参数中发送空字符串,它不会在移动屏幕上显示任何内容,但会产生声音。 Secondly, I tried it without the presence of this param. 其次,我在没有此参数的情况下进行了尝试。 But if this param is not present, it throws exception. 但是,如果不存在此参数,则会引发异常。 How to send silent push? 如何发送无声推送? Any ideas? 有任何想法吗?

My Laravel version is 5.4. 我的Laravel版本是5.4。

我在上面问题中显示的代码中犯的一个小错误是使用content_available而不是content-available

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM