Giter Club home page Giter Club logo

cordova-launch-review's Introduction

Cordova Launch Review plugin Latest Stable Version Total Downloads

Table of Contents

Overview

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

donate

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.

Installation

Using the Cordova/Phonegap CLI

$ cordova plugin add cordova-launch-review
$ phonegap plugin add cordova-launch-review

PhoneGap Build

Add the following xml to your config.xml to use the latest version from npm:

<gap:plugin name="cordova-launch-review" source="npm" />

Usage

The plugin is exposed via the LaunchReview global namespace.

launch()

Launches the store app using the given app ID. Supports both Android and iOS.

LaunchReview.launch(appId, success, error);

Parameters

  • {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
  • {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.

Example usage

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);
});

rating()

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);

Parameters

  • {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.

Example usage

LaunchReview.rating(function(){
    console.log("Successfully opened rating dialog");
},function(err){
    console.log("Error opening rating dialog: " + err);
});

isRatingSupported()

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();

Example usage

if(LaunchReview.isRatingSupported()){
    LaunchReview.rating();
}else{
    LaunchReview.launch(myAppId);
}

Example project

An example project illustrating use of this plugin can be found here: https://github.com/dpa99c/cordova-launch-review-example

cordova-launch-review's People

Contributors

dpa99c avatar

Watchers

James Cloos avatar Lucas Forchino avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.