Created
March 9, 2016 15:29
-
-
Save rajeevkannav/4b88157b814a933a5d64 to your computer and use it in GitHub Desktop.
Cordova
This file contains 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
/* 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