1

I'm a beginner developer and I need some help regarding ratings. What I want is to display menu items depending if a user has rated my app 5 stars.

For example, if a user rated 5 stars, I set the class="reviewed" and display menu items to do with that class.

I tried to follow http://ngcordova.com/docs/plugins/appRate/ I'm stuck on this problem.

Sampath
  • 63,341
  • 64
  • 307
  • 441
GRS
  • 2,807
  • 4
  • 34
  • 72
  • Hi, Apple introduced the new StoreKit in iOS 10.3 and developers can display an in-app review menu to rate the app by stars. Here's a cordova plugin for your ionic project https://github.com/omaxlive/com.omarben.inappreview – benLIVE Mar 31 '17 at 00:50

5 Answers5

4

The appRate plugin is simply a tool that shows a dialog to ask a user if they want to rate your app as shown below.

    enter image description here

In terms of the ratings pages the only function an app can perform is to send a user to the review page — apps do not have access to any of their ratings information and even if you can find a way to do it, it's against policies for both the Google Play and iTunes stores so the app would get rejected during review.

See the following answers:

Because of these restrictions with native iOS / Android, the same applies to Cordova.

Community
  • 1
  • 1
Lightbeard
  • 4,011
  • 10
  • 49
  • 59
  • thanks, how about if a user clicks on a button "rate us" and wheter he rates or not, we set a different version of the app. And display a new menu item, depending on its class. – GRS Jul 21 '16 at 20:37
1

If you wish to determine that the user has opted to view the store review page (without confirmation that they have actually performed a review or rating), use onButtonClicked() which can have the following values based on the apprate js source.

$cordovaAppRate.onButtonClicked(buttonIndex) {
      switch (buttonIndex) {
            case 1: // clicked 'Rate It Now'
            case 2: // clicked 'Remind Me Later'
            case 3: // clicked 'No, Thanks'
      }
};

With this you can do whatever you want, for example:

$cordovaAppRate.onButtonClicked(buttonIndex) {
    if(buttonIndex === 1) localStorage.setItem('REVIEWED', JSON.stringify(true));
};

Then you can add a class in the Angular controller for the page template easily. For example, with jquery:

.controller('MyMenuCtr', function($scope) {
    if(JSON.parse(localStorage.getItem('REVIEWED'))) $('ion-content').addClass('reviewed');
    ...
}
Lightbeard
  • 4,011
  • 10
  • 49
  • 59
1

Since iOS 10.3 you can make use of the awesome InAppReview from Apple. I can attest to the fact that this new way of reviewing apps has been very fruitful for our apps in terms of the number of reviews. You can read an even more compelling case study here of how Instagram doubled their reviews.

The cordova plugin, which is very easy to use and implement is here: https://github.com/omaxlive/com.omarben.inappreview.

For brevity, and in case that Github seize to exist (unlikely), here are the steps to use it:

Install the plugin: cordova plugins add com.omarben.inappreview

Call it in the code like this:

var requestReview = function(){
    try{
        var success = function() {
            console.log("Success");
        }
        var failure = function() {
            console.log("Error calling plugin");
        }

        inappreview.requestReview(success, failure);
    }catch(e){
        console.log("catch: "+e);
    }
};

Hope this helps someone...

Nikola
  • 14,888
  • 21
  • 101
  • 165
0

Ionic V3: https://ionicframework.com/docs/v3/native/launch-review/

Ionic >= V4: https://ionicframework.com/docs/native/launch-review

It has in app review for ios >10.3 (higher changes to get a review) and simply opens google play market for android.

Dependency injection:

import { LaunchReview } from '@ionic-native/launch-review';

constructor( 
    private _platform: Platform,
    private _launchReview: LaunchReview
) { }

Implementation:

appId = null;
if (this._platform.is('android')) {
    appID = '_COM.ANDROID.PACKAGE.NAME_';
} else if (this._platform.is('ios')) {
    appID = '_APPLEID_';
}

if (appID) {
    if (this._launchReview.isRatingSupported()) {
        // For iOS > 10.3
        this._launchReview.rating().then((result) => {
            alert(result);
        });
     } else {
        this._launchReview.launch(appID);
     }
}
TheBosti
  • 1,354
  • 13
  • 19
0

Ionic 5+ / Capacitor 3+ app

I have used this plugin: https://ionicframework.com/docs/native/app-rate

npm install cordova-plugin-apprate
npm install @ionic-native/app-rate
npm install cordova-plugin-dialogs
npm install cordova-plugin-nativestorage
ionic cap sync

.ts

writeAppReview(): void {
    this.appRate.setPreferences({
      displayAppName: 'My Networks',
      usesUntilPrompt: 3,
      promptAgainForEachNewVersion: false,
      storeAppURL: {
        ios: 'application id in AppStore',
        android: 'market://details?id=net.mynetworks.mymobileapp',
      },
      customLocale: {
        title: 'Enjoy using %@?',
        message: 'Recommend %@ to others by leaving a rating.',
        cancelButtonLabel: 'No, Thanks',
        laterButtonLabel: 'Later',
        rateButtonLabel: 'Rate It Now',
      },
      callbacks: {
        onRateDialogShow: (callback): any => {
          console.log('rate dialog shown!');
        },
        onButtonClicked: (buttonIndex): any => {
          console.log('Selected index: -> ' + buttonIndex);
        },
      },
    });

    this.appRate.promptForRating(true);
  }
Sampath
  • 63,341
  • 64
  • 307
  • 441