How to create a simple internal link to a post ( Ionic card )?


#1

What I am trying to achieve: Link my push notifications to a specific post. Posts’ routes are like this post/postId . If this not easy then I would do a link to the Posts view and I ll call it a day. Any help would be great as I can’t figure this out :frowning:


#2

you can add additional payload to a push notification.

Put the postId and the type “post” on it, if there are also other pushnotifications.

If you handle the pushnotification in your app --> check if the type is post and the postId is set --> redirect to the posts detail page


#3

Can you show a simple example with additional payload? I attempt to do this. Do I handle it in the $cordovaPush:notificationReceived or where? if yes, how :wink:


#4

you should handle it in the received callback.
But you are sending the notification from somewhere?? I do not know how ionic-push works in detail.

e.g. for android (search for payload):
https://developers.google.com/cloud-messaging/server-ref


#5

i implemented my own server using PHP. When I look at the Apple docs , they are using different terms that confuses me! If you have implemented it in any way or in any language that is a bit clear that may help me a bit but I appreciate your help already though.


#6

This is how the Message Object looks like. What confuses me, which property will $cordovaPush:notificationReceived look for to open the Post

$message = PushNotification::Message('Message Text',array(
'badge' => 1,
'sound' => 'example.aiff',

'actionLocKey' => 'Action button title!',
'locKey' => 'localized key',
'locArgs' => array(
    'localized args',
    'localized args',
),
'launchImage' => 'image.jpg',

'custom' => array('custom data' => array(
    'we' => 'want', 'send to app'
))

));


#7

should give you the message object as result?