简体   繁体   中英

cordovaAppRate : nothing happens when i click 'Rate now'

I'm trying to implement cordovaAppRate in an Ionic app, i already set the configs, and the dialog box with the options "Remind me later", "Rate now", and "No thanks" is successfully displayed, But when i click the link "Rate now", nothing happens!

I'm testing with an actual device with Android 5.1.1

here's my cordovaAppRate configs

  .config( function($cordovaAppRateProvider) {
    var preferences = {
      language: 'de',
      appName: 'MyAppName',
      openStoreInApp: false,
      androidURL: 'market://details?id=myapp.id',
      iosURL: 'myapp.id'
    }
    document.addEventListener("deviceready", function() {
      $cordovaAppRateProvider.setPreferences(preferences);
    }, false);
  })

This is the function that triggers the dialog box

$scope.rate = function() {
  if (typeof AppRate != 'undefined') {
    $cordovaAppRate.promptForRating(true);
  };
}

any idea of why the "Rate now" link is not working?

Skip the if clause - wrap instead in ionicPlatform.ready() function.

Be sure to know how to implement plugins in the ionic-framework. Some common pitfalls can be read about here: http://ngcordova.com/docs/common-issues/

An alternative is to use this callback:

AppRate.preferences.callbacks.onButtonClicked = function(buttonIndex) {

};

In this function, check what the buttonIndex of "Rate Now" button is (0, 1, or 2), and then use

$cordovaAppRate.navigateToAppStore() to manually navigate to the app store

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM