Search code examples
ionic-frameworkionic3ionic-native

AppRate.preferences.openUrl is not a function


I have recently installed the AppRate plugin for Ionic Cordova and i am having a problem when i click the button to rate the app, it shows my this error on the console: AppRate.preferences.openUrl is not a function

I have tried to find the property on the preferences, but i haven't found it.

Here is the code i am using:

appRate.preferences = {
      displayAppName: "My app name",
      promptAgainForEachNewVersion: true,
      storeAppURL: {
        ios: '*******',
        android: 'market://apps/details?id=com.****.****'
      },
      customLocale: {
        title: "Você está gostando do %@?",
        message: "Se você está gostando do %@, poderia nos ajudar avaliando-o na loja?",
        cancelButtonLabel: "Não, obrigado",
        laterButtonLabel: "Me lembre mais tarde",
        rateButtonLabel: "Avaliar",
        appRatePromptTitle: "Gostaria de avaliar o nosso aplicativo?",
        feedbackPromptTitle: "feedback prompt",
        noButtonLabel: "Não",
        yesButtonLabel: "Sim"
      },
      usesUntilPrompt: 1,
      simpleMode: true,
      inAppReview: true,
      callbacks: {
        onRateDialogShow: function (callback) {
          console.log('rate dialog shown!');
        },
        onButtonClicked: function (buttonIndex) {
          console.log('Selected index: -> ' + buttonIndex);
        }
      },
    }

    appRate.promptForRating(true);

I have hidden the storeAppUrl values for obvious reasons.

Here are the specs of my project:

Using Ionic 3, Angular-Ionic, AppRate version 4.20.0


Solution

  • Found out how to resolve this, it appears that the actual version of the plugin AppRate has this bug (1.5.0), so i switched it to the version 1.4.0.

    It's a common issue for many users, as we can see in these threads inside their github repo: https://github.com/pushandplay/cordova-plugin-apprate/issues/263 https://github.com/pushandplay/cordova-plugin-apprate/issues/274