I am currently testing push service on the devel system and the response code of pushed messages to the system is:
Our PUSH-ID: xxxxxxx
PUSH-ID: xxxxxxxx
REPLY-TIME: 2013-12-14T17:20:16Z
Response CODE: 1001
Response DESC: The request has been accepted for processing.
What does it mean? They accepted the message, but they are not pushing the message to the devices? I would think I need to get a "200" for a successful push to the devices. Or I am wrong?
Related
I am using the twilio quickstart chat app. After binding which appears it is successful in binding to my phone with a user id because I get this message:
Request Body: {"BindingType":"apn","identity":"xxxxxxx","Address":"xxxxxxxxxxxxxxxxxxxx"}
Response Body: {"message":"Binding created!"}
Message: Binding created!
JSON: {
message = "Binding created!";
}
but
when I attempt to send a notification I keep getting a strange error.
NotifySwiftQuickstart[1304:280270] [tcp] tcp_input [C1.1:3] flags=[R] seq=17319241, ack=0, win=0 state=LAST_ACK rcv_nxt=17319241, snd_una=956992709
Not sure what that means and how to fix it so that I get the expected outcome of the notification on the phone that it's bound to.
I am running that latest Xcode version on Big Spur.
The problem was that the "Request was malformed" The push notifications were rejected by APNs.
Twilio push infrastructure does not support the notifications to not main certificate topic. So application device token and certificate subject must have the same bundle id. For instance, for VoIP notifications the certificate subject must end with ".voip" and the device token app bundle ends with ".voip".
Corrected the push notifications in the app and everything works as intended.
I am developing a cross-platform application with xamarin forms and I'm trying to run notifications on the various devices through the notification hub.
I encounter a problem when I try to send a test notification for the iphone.
The device can register the token, received by apns, on the notification hub even if only after the '<' and '>' and spaces are deleted, otherwise, the notification hub returns the error "one or more characters in device token is not a hexadecimal digit".
However, when I try to send a first test notification, Notification Hub returns:
"The test message has been sent. Outcome: {1 success, 0 unsuccessful}"
but notification never reaches the device. All the test notifications sent subsequently result:
"The test message has been sent. Outcome: {0 success, 0 unsuccessful}"
In fact, going to see the metrics in the notification hub the next day there are some
"APNS bad Channel Error"
So what could be the problem? Did anyone have the same problem? And what does "APNS bad channel error" mean?
The APNS Bad channel error indicates the device token you are using is no longer valid. Your app on the device needs to update the token on app. You can include that as part of application restart.
Also, regarding the notication not reaching the device. Can you make sure the device is switched on and notification are turned on. You can try to set the apns-expiration header to a longer value so that apns stores the notification for redelivery for a longer time.
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html#//apple_ref/doc/uid/TP40008194-CH11-SW13
Thanks,
Amol
I have an iOS app that receives notification from APNS. If my user deletes the app there is no way for the backend to know the app is not installed on a certain device(device token). In this case what error code will be generated when trying to push via APNS, so that i can remove the entry from the database?
There is a Provider (Your backend server) API introduced by Apple in WWDC-2015 & enhanced in 2016 to give more valuable feedback to the server about the push notification. Here is a transcript to that WWDC session.
From the transcript: "If a device token has been removed, you will get an HTTP/2 response with status 410, or "removed."
It will have a time stamp in payload indicating when APNS last learned that the device token has been removed."
APNS Server Response Codes
200 Success
400 Bad request
403 There was an error with the certificate or with the provider
authentication token.
405 The request used a bad :method value. Only POST requests are
supported.
410 The device token is no longer active for the topic.
413 The notification payload was too large.
429 The server received too many requests for the same device token.
500 Internal server error
503 The server is shutting down and unavailable.
Now what I cannot confirm to you is that if iOS removes the device token if app is removed or if notification setting is turned off from App settings without deleting app.
"410 does mean the app was uninstalled. The token will remain active if the user disables notification alerts in the app settings. The device will still receive the notification, even if no alert is shown to the user. The server will not know if the user has turned off notification alerts. Only the app knows this."
Thanks to Marcus Adams for clartfying this doubt.
Here goes the Apple Developer Guide!!!
If required, Here is a Paid SDK that can help you with uninstallation tracking.
We are attempting to send push notifications via Azure Notification Hub and aren't able to send messages from Azure.
We've tried debugging but have been unable to figure out the error from the documentation.
How can we debug this further? We've walked through MSDN's documentation in detail but haven't been able to come up with anything
Here's our process:
We have the certificate setup in our iphone app and in Azure Notification Hub
We create our hub connection via NotificationHubClient with the debug option enabled before any Azure calls
NotificationHubClient.CreateClientFromConnectionString(NOTIFICATION_SERVICE_CONNECTION_STRING, NOTIFICATION_SERVICE_NAME, true)
We register the device upon logging into the app (and we're updating the push id if it changes)
//simplified process showing a new registration only
RegistrationDescription registration =
Hub.CreateAppleNativeRegistrationAsync(data.PushId, new List<string>() { "member:10" });
registration.RegistrationId = Hub.CreateRegistrationIdAsync().Result;
var result = Hub.CreateOrUpdateRegistrationAsync(registration).Result;
Result: We appear to get back a successful RegistrationDescription that shows our registration id, tags, device token (pushId), etag and registration id. We do show successful registration operations in the Azure Monitor.
Note: After registering the device, we don't see an increase in active devices or registrations in our Azure dashboard (0 Active Devices and 0 registrations in the dashboard)
We send a notification
// example apns: {"aps":{"alert":{"title":"TESTING","body":"Test notification"}},"MemberId":150888,"RelatedId":1,"NotificationType":2,"NotificationTypeId":2}
var notification = Hub.SendAppleNativeNotificationAsync(apns.ToJson(), "member:10").Result;
Result: We normally receive a result similar to below, however a notification is not sent
"Notification state: DetailedStateAvailable, success: 1, tracking id: xxxxxx-xxxx-xxxx-xxxx-xxxxxx, notification id: {empty} Platform: apple, Device reg id: {removed for security}, Result: The Notification was successfully sent to the Push Notification System, PnsHandle: xxx"
Other Notes: We do see several "Invalid Channel Errors", "APNS Bad Channel Error" and "APNS Expired Channel Errors" but cannot find the source. We also see several Successful Notifications logged in Azure, but never receive the notification.
The success states that you were able to request a send.
The Invalid Channel Errors and APNS Bad Channel Error indicate that you have an invalid device token. This typically happens because:
You have told NH you are using the APNS sandbox, but your app is getting tokens for APNS production.
OR
Reverse the states in #1 (NH thinks you have APNS production, your app is getting tokens for APNS sandbox)
I am developing an MDM solution. I have successfully installed profile on the device. Checked in the device on the server and got PushMagic and Token as PUT messages.
Now I am sending MDM payload before sending the command, but the device is not polling for the command as I can see in the IPCU console. How can I test if the payload is getting to the APNS server and if the APNS server is sending the push notification to the device? Is there any status code I get after sending the message to APNS? What is the correct length of the Token(I am getting 44 characters, and I am doubtful about the integrity of that).