How to prepare APN for production

249
January 16, 2018, at 5:48 PM

Im trying to deploy my app with notifications but it's giving me the biggest headache in the world. All other questions ive seen with regards to this seem outdated.

I set up APNs to be sent from a nodeJS script that I have running. When running in my sandbox everything was working well. As soon as I sent my app to TestFlight, notifications stopped sending. My script is still Successfully sending to the Notification Id registered with my phone but im assuming its not the correct production Id. If anyone canhelp get me sending production notifications it would be greatly appreciated! Thank you

APN Server code

 var options = {
token: {
key: "AuthKey_6V27D43P5R.p8",
keyId: "3Z6SEF7GE5",
teamId: "ASQJ3L7765"
},
    production: true
};
var apnProvider = new apn.Provider(options);
function SendIOSNotification(token, message, sound, payload, badge){
var deviceToken = token; //phone notification id
var notification = new apn.Notification(); //prepare notif
notification.topic = 'com.GL.Greek-Life'; // Specify your iOS app's Bundle ID (accessible within the project editor)
notification.expiry = Math.floor(Date.now() / 1000) + 3600; // Set expiration to 1 hour from now (in case device is offline)
notification.badge = badge; //selected badge
notification.sound = sound; //sound is configurable
notification.alert = message; //supports emoticon codes
notification.payload = {id: payload}; // Send any extra payload data with the notification which will be accessible to your app in didReceiveRemoteNotification
    apnProvider.send(notification, deviceToken).then(function(result) {  //send actual notifcation
    // Check the result for any failed devices
    var subToken = token.substring(0, 6);
    console.log("Succesfully sent message to ", subToken);
    }).catch( function (error) {
            console.log("Faled to send message to ", subToken);
    })
}
Rent Charter Buses Company
READ ALSO
Accessing gmail from nodejs returns only message id

Accessing gmail from nodejs returns only message id

I keep trying to get the information for my messages, but I only get the id; the rest is undefined:

236
events.js:142 error in node.js and express framework and MongoDB [on hold]

events.js:142 error in node.js and express framework and MongoDB [on hold]

user@lenovo MINGW64 /c/Projects/BookStore $ node app Running on port 3000events

279
Mongo DB can't change install location [on hold]

Mongo DB can't change install location [on hold]

I'm trying to install mongo db right now to my hard drive, and I can't figure out how to change my install pathIt says that I don't have enough space on my SSD, so I try to change the install location to my hard drive and it still doesn't work, just gives me the same error

148
Running cron job at only specific date and time

Running cron job at only specific date and time

In our express js application have a feature in admin module that he can send mail to users at specific dates (he can able to select a specific date and time)

212