I have the following code which registers my iOS device with my APNS server:
pushNotification.registerDevice({
alert: true,
badge: true,
sound: true,
pw_appid: "***",
appname: "***"
},
function (status) {
var deviceToken = status['deviceToken'];
},
function (status) {
console.warn('failed to register : ' + JSON.stringify(status));
navigator.notification.alert(JSON.stringify(['failed to register ', status]));
});
This runs onLoad, but I need to access deviceToken outside of the scope of pushNotification.registerDevice() function (status).
Is it possible, in this case, to access deviceToken which is inside a function within a function, outside of the function?
I thought I could make it a global variable, by using window.deviceToken, then calling that later on, but it returns undefined.