Skip to content

Instantly share code, notes, and snippets.

@rajeevkannav
Created March 9, 2016 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajeevkannav/4b88157b814a933a5d64 to your computer and use it in GitHub Desktop.
Save rajeevkannav/4b88157b814a933a5d64 to your computer and use it in GitHub Desktop.
Cordova
/* Invoke sync with the custom options, which enables user interaction.
For customizing the sync behavior, see SyncOptions in the CodePush documentation. */
window.codePush.sync(
function (syncStatus) {
switch (syncStatus) {
// Result (final) statuses
case SyncStatus.UPDATE_INSTALLED:
console.log("The update was installed successfully. For InstallMode.ON_NEXT_RESTART, the changes will be visible after application restart. ");
break;
case SyncStatus.UP_TO_DATE:
console.log("The application is up to date.");
break;
case SyncStatus.UPDATE_IGNORED:
console.log("The user decided not to install the optional update.");
break;
case SyncStatus.ERROR:
console.log("An error occured while checking for updates");
break;
// Intermediate (non final) statuses
case SyncStatus.CHECKING_FOR_UPDATE:
console.log("Checking for update.");
break;
case SyncStatus.AWAITING_USER_ACTION:
console.log("Alerting user.");
break;
case SyncStatus.DOWNLOADING_PACKAGE:
console.log("Downloading package.");
break;
case SyncStatus.INSTALLING_UPDATE:
console.log("Installing update");
break;
}
});
var push = PushNotification.init({
android: {
senderID: "12345679"
},
ios: {
alert: "true",
badge: "true",
sound: "true"
},
windows: {}
});
push.on('registration', function(data) {
// data.registrationId
});
push.on('notification', function(data) {
// data.message,
// data.title,
// data.count,
// data.sound,
// data.image,
// data.additionalData
});
push.on('error', function(e) {
// e.message
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment