phpioslaravelpush-notificationsilent-notification

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. 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. 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.


Solution

  • Such a trivial mistake that I made in the code shown above in the question is to use content_available instead of content-available.