Hi.
I’m trying to get the Payload Data from a click of push notification, but for some reason android no found any listeners for pushNotificationActionPerformed.
Server code - Push Payload (the push is sent with cURL lib from PHP, and i want to access the content and id fields) :
$fields = array(
"to" => $token,
"notification" => array (
"title" => $title,
"body" => $body
),
"data" => array (
'type' => $contentType,
'id' => $contentId
)
);
In the Ionic Code:
PushNotifications.requestPermission().then( result => {
if (result.granted) {
PushNotifications.register();
}
});
PushNotifications.addListener('registration',
async (token: PushNotificationToken) => {
console.log("device registration");
});
PushNotifications.addListener('registrationError',
(error: any) => {
console.log('Error on registration: ' + JSON.stringify(error));
});
PushNotifications.addListener('pushNotificationReceived',
(notification: PushNotification) => {
alert('Push received: ' + JSON.stringify(notification));
}
);
PushNotifications.addListener('pushNotificationActionPerformed',
(notification: PushNotificationActionPerformed) => {
alert('Push action performed: ' + JSON.stringify(notification));
}
);
If for some reason this is not the right direction for my case, feel free to say.
Thanks in advance