mac-cain13 / notificato

Takes care of Apple push notifications (APNS) in your PHP projects.
MIT License
224 stars 44 forks source link

How to add the custom information with the push notification? #56

Closed manifsp closed 8 years ago

manifsp commented 8 years ago

I am sending push notifications from php job application to iphone. I am sending push notifications regarding new jobs. Is this possible that when user click on the view of push notification pop up , then user redirect to the particular job in the device.

I mean I wanted to know can I send any custom data with push notification like access_token, something else....so that Iphone end Can retrieve and show the particular job ?

Regardless of the language and library you use, the push notification payload is a JSON payload: { "aps": { "badge": 10, "alert": "Hello world!", "sound": "cat.caf" } }

We want add custom information with the push notification. Like below

{ "aps": { "badge": 10, "alert": "Hello world!", "sound": "cat.caf" }, "access_token": 1 }

Thanks.

mac-cain13 commented 8 years ago

You could use the setPayload() method: https://github.com/mac-cain13/notificato/blob/master/src/Wrep/Notificato/Apns/MessageBuilder.php#L215-L226

Would that answer your question?

manifsp commented 8 years ago

Yes, Now I'm getting the access_token with push notification. Thanks for your great support and fastest reply.