1
votes

I'm using Azure Notification Hub as my service to send push notification to mobile devices.

I developed a simple node server to register and send push notification.

I have already done implementing push notification and mobile clients can now receive push from my server but specifically for SANDBOX and PRODUCTION.

Is there a way that my server can send push notification in both SANDBOX and PRODUCTION (together) in one request?

This is my code for sending push notification in SANDBOX/PRODUCTION

var payLoad = {
        aps: {
            alert: data
        }
    };
    azure.apns.send(tag, payLoad, function (err, reps){
        if(!err){
            cb({error: false});
        }else{
            cb({error: true, error_log: err});
        }
    })
1

1 Answers

2
votes

There's no reason to do that. These are two intentionally separate and isolated environments.

Here's an older blog post that outlines basic facts about the two:

General Rule of Thumbs:

Keep in mind that the sandbox (development) environment is entirely separate to the production environment. Let me repeat: Keep in mind that the sandbox (development) environment is entirely separate to the production environment. Mixing device tokens and certifications across the environment will lead to a lot of nothing (that is, non responses). Servers needs push certificates from the provisioning portal. Clients register themselves with push services by communicating with Apple servers. The two environments have items needed specific to them. More specifically:

Servers need a separate developer certificate and production certificate. Client get a different device token when registering themselves in development builds vs applications downloaded from the App Store. Therefore, the following rules exist (unless you do some hackery I’m not currently aware of):

Development builds of your client (that is, any build put on your device from the development environment including Ad Hoc) will get development device tokens when registering with the APNS. Which means you can’t test production server settings with at development build on your client. Attempts to do so will lead to confusion and wasted time. Production builds (that is, the app actually downloaded from the App Store) will get production device tokens. These must be tested with production APNS server settings.