Last active
April 1, 2016 21:07
-
-
Save addityasingh/68956e1cb3a1cab9bb3513df64e3907d to your computer and use it in GitHub Desktop.
Setup phonegap-push-plugin for ionic app
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
$PATH_TO_PROVISIONING_PROFILE = "" | |
$DEVELOPER_TEAM_ID = "" | |
xcodebuild PROVISIONING_PROFILE="$PATH_TO_PROVISIONING_PROFILE" CODE_SIGN_IDENTITY="$DEVELOPER_TEAM_ID" |
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
function registerForPush () { | |
if ($window.PushNotification) { | |
var push = $window.PushNotification.init({ | |
ios: { | |
“badge”: false, | |
“sound”: true, | |
“alert”: true, | |
“clearBadge”: true | |
} | |
}); | |
push.on(‘registration’, function(deviceToken){ | |
$rootScope.deviceToken = deviceToken.registrationId || ‘’; // Send this devicetoken to your app servers | |
}); | |
push.on(‘error’, function(data) { | |
console.log(“Push plugin registration error”+ JSON.stringify(data)); | |
}); | |
push.on(‘notification’, function(data) { | |
$rootScope.$broadcast(‘push-notification-data’, { data: data.additionalData }); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment