Table of Contents
This Cordova/Phonegap plugin for iOS and Android launches the native store app in order for the user to leave a review.
On Android, the plugin opens the the app's storepage in the Play Store where the user can leave a review by pressing the stars to give a rating.
On iOS, the plugin opens the app's storepage in the App Store, focuses the Review tab, and automatically opens the dialog for the user to leave a rating or review. On iOS 10.3 and above, there is also support for the in-app ratings dialog which allows a user to rate your app without needing to open the App Store.
The plugin is registered on npm (requires Cordova CLI 5.0.0+) 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.
Using the Cordova/Phonegap CLI
$ cordova plugin add cordova-launch-review
$ phonegap plugin add cordova-launch-review
Add the following xml to your config.xml to use the latest version from npm:
<gap:plugin name="cordova-launch-review" source="npm" />
The plugin is exposed via the LaunchReview
global namespace.
Launches the store app using the given app ID. Supports both Android and iOS.
LaunchReview.launch(appId, success, error);
- {string} appID - the platform-specific app ID to use to open the page in the store app
- On Android this is the full package name of the app. For example, for Google Maps:
com.google.android.apps.maps
- On iOS this is the Apple ID of the app. For example, for Google Maps:
585027354
- On Android this is the full package name of the app. For example, for Google Maps:
- {function} success - Function to execute on successfully launching store app.
- {function} error - Function to execute on failure to launch store app. Will be passed a single argument which is the error message string.
var appId, platform = device.platform.toLowerCase();
switch(platform){
case "ios":
appId = "585027354";
break;
case "android":
appId = "com.google.android.apps.maps";
break;
}
LaunchReview.launch(appId, function(){
console.log("Successfully launched store app");
},function(err){
console.log("Error launching store app: " + err);
});
Opens the in-app ratings dialogs introduced by iOS 10.3. iOS only. Calling this on any platform other than iOS 10.3 or above will result in the error function being called.
LaunchReview.rating(success, error);
- {function} success - Function to execute on successfully launching rating dialog.
- {function} error - Function to execute on failure to launch rating dialog. Will be passed a single argument which is the error message string.
LaunchReview.rating(function(){
console.log("Successfully opened rating dialog");
},function(err){
console.log("Error opening rating dialog: " + err);
});
Indicates if the current platform supports in-app ratings dialog, i.e. calling LaunchReview.rating()
.
Will return true if current platform is iOS 10.3 or above.
LaunchReview.isRatingSupported();
if(LaunchReview.isRatingSupported()){
LaunchReview.rating();
}else{
LaunchReview.launch(myAppId);
}
An example project illustrating use of this plugin can be found here: https://github.com/dpa99c/cordova-launch-review-example