离子本机应用程序速率不适用于Android [英] Ionic native app rate not working for android

查看:56
本文介绍了离子本机应用程序速率不适用于Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建多个离子应用程序,其他应用程序中的应用程序速率选项完美,但在一个应用程序中甚至没有显示应用程序速率提示.我的应用费率功能如下所示

I am Building multiple ionic apps, app rate option in other apps perfectly but in one app its not showing app rate prompt even. My app rate function looks like following

    rate(){
    this.appRate.preferences.storeAppURL = {
      // ios: '',
      android: 'market://details?id=app_id',
      // windows: 'ms-windows-store://review/?ProductId=<store_id>'
    };

    this.appRate.promptForRating(true);

    // or, override the whole preferences object
    this.appRate.preferences = {
      usesUntilPrompt: 3,
      storeAppURL: {
        // ios: '<app_id>',
        android: 'market://details?id=app_id',
        // windows: 'ms-windows-store://review/?ProductId=<store_id>'
      }
    };
    this.appRate.promptForRating(false);
  }

并且html代码是

<button ion-button color="vibrant" (click)="rate()"><span style="color:#e2c767">Rate App Now</span></button>

推荐答案

您需要添加其他配置设置.我犯了与您无意中犯的错误相同的错误.在构造函数中包含以下代码,

You need to add other configuration settings. I committed the same mistake that you have inadvertently made. Include the following code in the constructor,

appRate.preferences = {
    storeAppURL: {
      ios: '<app_id>',
      android: 'market://details?id=<package_name>',
      windows: 'ms-windows-store://review/?ProductId=<store_id>'
    },
    customLocale: {
      title: 'Do You Enjoy?',
      message: 'Please Rate Us',
      cancelButtonLabel: 'No Thanks',
      laterButtonLabel: 'Remind me later',
      rateButtonLabel: 'Rate It Now',

    },
    callbacks: {
      onRateDialogShow: function (callback) {
        console.log('dfcsd');
      },
      onButtonClicked:function(buttonIndex){
        console.log('Selected Index is '+buttonIndex);
      }
    },
    simpleMode:true
  }

添加完整的配置设置,包括回调和customLocale,如上面的代码所示.最后,在rate()函数中,

Add the full configurations settings including the callbacks and customLocale as evident from the code above. And then finally, in the rate() function,

 this.appRate.promptForRating(true);

这篇关于离子本机应用程序速率不适用于Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆