Closed andyduong1920 closed 8 years ago
Hi @anduonghien , is your issue resolved
Hi @Bill-SnowWolf -- when passing a value to badge, you must precede it with either a plus or minus, e.g.:
Urbanairship.ios(alert: "hello", badge: "+1")
Urbanairship.ios(alert: "hello", badge: "-1")
The "+1" will increase a user's badge count by one, while the "-1" will decrease the count by one. Please let me know if this addresses your issue.
EDIT: I should also mention that passing in an integer will reset a user's badge count to the specified value. While the above examples increase or decrease the badge value by one, the following payload would reset a user's badge count to 23:
Urbanairship.ios(alert: "hello", badge: 23)
@madelgi There seems like a problem with Urbanairship API V3. Even I tried to manually send curl request with badge parameter, it will fail with this error:
{"ok":false,"error":"Could not parse request body.","error_code":40000,"details":{"error":"The key 'badge' is not allowed in this context","path":"notification.badge","location":{"line":1,"column":117}},"operation_id":"f54ed775-811e-4fe2-bcdf-ad5e0a3c2654"}
So for future reference, the platform specific parameters should be wrapped in a platform object. The documentation has a typo.
Instead of calling:
push.notification = UA.ios(alert: "hello", badge: "+1")
it should be:
push.notification = UA.notification(ios: UA.ios(alert: "Hello iOS", badge: "+1"))
Hey, I'm using Urban AirShip via https://github.com/urbanairship/ruby-library. I try to send push notification to ios with param
Urbanairship.ios(alert: "hello", badge: "1")
But I get errorHowever, I try with
Urbanairship.ios(alert: "hello") or Urbanairship.notification(alert: "hello")
it work OK.Please help me, thank you.