Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Apple Push Notification sandbox as a virtual device?

Apple's APN Service Programming Guide in the Provisioning and Development section claims that "[t]he sandbox environment also acts a virtual device, enabling simulated end-to-end testing." However I couldn't find any information how this virtual device can be accessed (e.g. how do you get a device token, how do you check the status of notifications sent, etc.) Does anyone know if this information is valid and if it is how does one go about doing end-to-end testing using the sandbox as a virtual device?

like image 946
Svetoslav Avatar asked Oct 05 '09 10:10

Svetoslav


People also ask

How do I use Apple push notifications for APN?

When you have a notification to send to a user, your provider must construct a POST request and send it to Apple Push Notification service (APNs). Your request must include the following information: The JSON payload that you want to send. The device token for the user's device.

Does Apple support push notifications?

To use Apple Push Notification Service (APNs), your macOS, iOS, tvOS, and watchOS devices need a persistent connection to Apple's servers over Ethernet, cellular data (if capable), or Wi-Fi.

What is Apple push notification used for?

Apple Push Notification service (commonly referred to as Apple Notification Service or APNs) is a platform notification service created by Apple Inc. that enables third party application developers to send notification data to applications installed on Apple devices.


1 Answers

Getting a device token works the same in sandbox servers as it does in production servers - you just get a development device token that can only be used when talking to their sandbox servers. However, just like the production servers, you can't check the status of notifications sent or anything like that.

The "virtual device" wording is confusing, because it's really just a separate set of infrastructure that only talks to development applications/device tokens.

So, just talk to the development servers while you're developing your app (that is, when your app is built with a development provisioning profile) and talk to production servers when the app is built in ad-hoc or production mode. The process is going to be same.

However, be sure not to mix development device tokens and production device tokens.

Also, push notifications don't work in the simulator, so you will need an actual device to test on. If you're testing on an iPod Touch, be sure to keep in mind that it will only check for messages every fifteen minutes or so if the backlight is off.

Hope this helps!

like image 69
Michael Richardson Avatar answered Oct 15 '22 04:10

Michael Richardson