Created
August 22, 2016 23:16
-
-
Save dabit3/94d73123a2264c20af03c6abd1b207c8 to your computer and use it in GitHub Desktop.
services.js updated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// initialize | |
if (typeof PushNotification === "defined") { | |
// your code here | |
$cordovaPushV5.initialize(options).then(function() { | |
// start listening for new notifications | |
$cordovaPushV5.onNotification(); | |
// start listening for errors | |
$cordovaPushV5.onError(); | |
// register to get registrationId | |
$cordovaPushV5.register().then(function(deviceToken) { | |
// Success -- send deviceToken to server, and store for future use | |
console.log("your deviceToken: " + deviceToken); | |
console.log('url should be showing'); | |
console.log(deviceType); | |
console.log('the url is: '+ WORDPRESS_PUSH_URL); | |
console.log(WORDPRESS_PUSH_URL + '/savetoken/?device_token='+ deviceToken +'&device_type='+ deviceType); | |
console.log(regDetails); | |
$http.post(regDetails); | |
console.log('everything worked.'); | |
}, function(error) { | |
alert("Registration error: " + error); | |
}); | |
}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment