Closed emilkarl closed 5 years ago
@ewal? :)
Hi! We set content-available to 1 so that we can track the notification when it arrives. If you want to ignore these tracking notifications in your code you can use the remoteNotificationType: https://docs.pusher.com/beams/reference/ios#handle-notification
Does this solve your issue?
@jonathanlloyd I can see userShouldIgnore = 1;
in the notification... but that is also set if I click on the notification. So basically if the app is open and I get a notification, this is set. I the app is closed or in the background and I click on the notification in my code... userShouldIgnore = 1;
is also set.
@emilkarl we have updated the docs and explain in details when the status is .ShouldProcess
or .ShouldIgnore
: https://docs.pusher.com/beams/reference/ios#-handlenotification
Let me know if this issue is still relevant or if you have any other questions.
Thanks!
For me, I see content-available: 1
(which I did not set) and userShouldIgnore: 1
, even though the docs (at your link) say:
Case | Status |
---|---|
Whenever content-available: 1 is set. |
.shouldProcess |
I do get a .shouldIgnore
anyway.
This is how I create my push notifications in the backend (PHP):
$this->beamsClient->publishToUsers(
$userIDs,
array(
"apns" => array("aps" => array(
"alert" => array(
"title" => "Hello, world!",
"body" => "This is my first push notification!."
)
)
)
));
...which yields this payload (as inspected from userInfo
in AppDelegate's didReceiveRemoteNotification
:
{
"aps" : {
"content-available" : 1,
"alert" : {
"title" : "Hello, world!",
"body" : "This is my first push notification!."
}
},
"data" : {
"pusher" : {
"instanceId" : "<redacted>",
"userShouldIgnore" : true,
"publishId" : "<redacted>"
}
}
}
I'm experiencing the same problem as @LinusGeffarth - anyone have any thoughts?
How is
content-available
implemented. It seems like it is always set to1
for us. And I cannot see how I can set this myself.We have background notifications enabled but dont want all of them to trigger this. We would like to be able to send custom data that we can use to navigate the user when the notification is clicked.
I'm just pushing some data with: