Table of Contents
Cordova/Phonegap plugin for iOS and Android to assist in leaving user reviews/ratings in the App Stores.
The plugin published to npm as cordova-launch-review
I dedicate a considerable amount of my free time to developing and maintaining this Cordova plugin, along with my other Open Source software. To help ensure this plugin is kept updated, new features are added and bugfixes are implemented quickly, please donate a couple of dollars (or a little more if you can stretch) as this will help me to afford to dedicate time to its maintenance. Please consider donating if you're using this plugin in an app that makes you money, if you're being paid to make the app, if you're asking for new features or priority bug fixes.
$ cordova plugin add cordova-launch-review
The plugin is exposed via the LaunchReview
global namespace.
Platforms: Android and iOS
Launches the App Store page for the current app in order for the user to leave a review.
On iOS, opens the app's page in the App Store and automatically opens the dialog for the user to leave a rating or review.
LaunchReview.launch(success, error, appId);
com.google.android.apps.maps
585027354
LaunchReview.launch();
var appId, platform = device.platform.toLowerCase();
switch(platform){
case "ios":
appId = "585027354";
break;
case "android":
appId = "com.google.android.apps.maps";
break;
}
LaunchReview.launch(function(){
console.log("Successfully launched store app");
},function(err){
console.log("Error launching store app: " + err);
}, appId);
Platforms: Android and iOS
On Android, invokes the native in-app review dialog which allows a user to rate/review your app without needing to open the Play Store.
LaunchReview.rating(success, error);
iOS notes
LaunchReview.rating()
is called - iOS limits the frequency with which it can be called (see here).LaunchReview.rating()
is called and the request to show the dialog is successful. Will be passed the value requested
.shown
.dismissed
.Android notes
success
or error
will not be called if dialog was not shown due to rate limiting, etc.
requested
, shown
or dismissed
.LaunchReview.rating()
is called and the request to show the dialog is successful with value requested
.shown
.dismissed
.requested
LaunchReview.rating();
//max time to wait for rating dialog to display on iOS
var MAX_DIALOG_WAIT_TIME_IOS = 5*1000;
//max time to wait for rating dialog to display on Android and be submitted by user
var MAX_DIALOG_WAIT_TIME_ANDROID = 60*1000;
var ratingTimerId;
function ratingDialogNotShown(){
var msg;
if(cordova.platformId === "android"){
msg = "Rating dialog outcome not received (after " + MAX_DIALOG_WAIT_TIME_ANDROID + "ms)";
}else if(cordova.platformId === "ios"){
msg = "Rating dialog was not shown (after " + MAX_DIALOG_WAIT_TIME_IOS + "ms)";
}
console.warn(msg);
}
function rating(){
if(cordova.platformId === "android"){
ratingTimerId = setTimeout(ratingDialogNotShown, MAX_DIALOG_WAIT_TIME_ANDROID);
}
LaunchReview.rating(function(status){
if(status === "requested"){
if(cordova.platformId === "android"){
console.log("Displayed rating dialog");
clearTimeout(ratingTimerId);
}else if(cordova.platformId === "ios"){
console.log("Requested rating dialog");
ratingTimerId = setTimeout(ratingDialogNotShown, MAX_DIALOG_WAIT_TIME_IOS);
}
}else if(status === "shown"){
console.log("Rating dialog displayed");
clearTimeout(ratingTimerId);
}else if(status === "dismissed"){
console.log("Rating dialog dismissed");
clearTimeout(ratingTimerId);
}
}, function (err){
console.error("Error launching rating dialog: " + err);
clearTimeout(ratingTimerId);
});
}
rating(); // app invokes eg. via UI action
Platforms: Android and iOS
Indicates if the current platform/version supports in-app ratings dialog, i.e. calling LaunchReview.rating()
.
Will return true
if current platform is Android or iOS 10.3+.
var isSupported = LaunchReview.isRatingSupported();
if(LaunchReview.isRatingSupported()){
LaunchReview.rating();
}else{
LaunchReview.launch();
}
An example project illustrating use of this plugin can be found here: https://github.com/dpa99c/cordova-launch-review-example
================
The MIT License
Copyright (c) 2015-2020 Working Edge Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.