Skip to content

Instantly share code, notes, and snippets.

@mariusbolik
Created September 28, 2018 19:51
Show Gist options
  • Save mariusbolik/19180283fdf9548cf14344bcf58cec14 to your computer and use it in GitHub Desktop.
Save mariusbolik/19180283fdf9548cf14344bcf58cec14 to your computer and use it in GitHub Desktop.
The way to use Cordova Plugin "App Rate" in other languages.
rateApp() {
this.platform.ready().then(() => {
if (this.platform.is('cordova')) {
this.appRate.preferences = {
displayAppName: 'Skills4School',
simpleMode: true,
useLanguage: 'en', // Needed. Otherwise will crash.
storeAppURL: {
ios: '1350221649',
android: 'market://details?id=de.skills4school.app'
},
customLocale: {
title: "Bewerte %@",
message: "Wenn dir %@ gefällt, würdest Du es bitte bewerten? Dies wird nicht länger als eine Minute dauern. Danke für die Unterstützung!",
cancelButtonLabel: "Nein, danke",
laterButtonLabel: "Später erinnern",
rateButtonLabel: "Jetzt bewerten"
},
callbacks: {
onRateDialogShow: function (callback) {
console.log('rate dialog shown!');
},
onButtonClicked: function (buttonIndex) {
// Use this function to issue Credits for App Ratings
console.log('Selected index: -> ' + buttonIndex);
}
}
};
// Opens the rating immediately no matter what preferences you set
this.appRate.promptForRating(true);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment