From the online API:
An HTTP PUT to /api/device_tokens/ registers a device token on our end. This lets us know that the device token is active, and should happen every time the application is opened to ensure that the list of device tokens remains up-to-date.
How do I go about acquiring the device token in the first place?
I believe you need to look here: implement the application:didRegisterForRemoteNotificationsWithDeviceToken
method to receive the device token.
EDIT: the Urban Airship guide is at http://urbanairship.com/docs/apns_test_client.html.
EDIT: The only way to send an APNS message is using the device token: you have to pass the device token back to whichever non-Apple server is the origination point for the notification. There are 3 logical entities in the transaction: the device, the APNS server (Apple's backend), and the originating server (in this case Urban Airship's server). The device and Apple's backend have the token already (or can generate it). The Urban Airship server only gets that token when you send it to them from the device. It can then use that token to communicate with the APNS backend and identify the device. What you do is you use the application:didRegisterForRemoteNotificationsWithDeviceToken
callback and then you send (via HTTP, or whatever other wire protocol you so choose) that token to the originating server (the Urban Airship docs show you how do that with their library). Their server can now use that token to communicate with the APNS backend.
To get the device token, you have a few options:
You can find it as one of the arguments sent in your app delegate's application:didRegisterForRemoteNotificationsWithDeviceToken:
method.
You can get it as an NSString by calling [[UAPush shared] deviceToken]
after your device has successfully registered for remote notifications.
If you don't have access to the code. You can find it by reading your app's calls to urban airship. You can do this with Charles proxy. Full instructions at this link. To sum it up:
*.urbanairship.com
on port 443.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With