Javascript 通知XDK不起作用

Javascript 通知XDK不起作用,javascript,android,function,cordova,intel-xdk,Javascript,Android,Function,Cordova,Intel Xdk,我正在使用org.pushandplay.cordova.apprate和Android的XDK。它就是不起作用。也许这是个语法问题,但我想不出来。我已经搜索了相当多的论坛,没有足够的答案 我是这样做的: 我安装了org.pushandplay.cordova.apprate插件,最新版本 我将以下代码放在文件js/app.js中: 功能速率按钮(){ var customLocale={}; customLocale.title=“为该应用程序评分”; customLocale.messag

我正在使用org.pushandplay.cordova.apprate和Android的XDK。它就是不起作用。也许这是个语法问题,但我想不出来。我已经搜索了相当多的论坛,没有足够的答案

我是这样做的:

我安装了org.pushandplay.cordova.apprate插件,最新版本

我将以下代码放在文件js/app.js中:

功能速率按钮(){
var customLocale={};
customLocale.title=“为该应用程序评分”;
customLocale.message=“如果您觉得这个应用程序有用,请将其评为5星!”;
customLocale.cancelButtonLabel=“不,谢谢”;
customLocale.laterButtonLabel=“稍后提醒我”;
customLocale.rateButtonLabel=“立即评级”;
AppRate.preferences.openStoreInApp=true;
AppRate.preferences.storeAppURL.android=market://details?id=com.my.project';
AppRate.preferences.customLocale=customLocale;
AppRate.preferences.displayAppName='我的项目';
AppRate.preferences.usesUntilPrompt=1;
AppRate.preferences.promptAgainForEachNewVersion=false;
通知、提示(真实);

};似乎工作正常,以下是我测试的完整代码:

<!DOCTYPE html>
<html>

  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">  

      <script src="cordova.js"></script>
      <script>

function rateButton() {
  var customLocale = {};
  customLocale.title = "Rate this App";
  customLocale.message = "Rate this App 5 star if you found it useful!";
  customLocale.cancelButtonLabel = "No, Thanks";
  customLocale.laterButtonLabel = "Remind Me Later";
  customLocale.rateButtonLabel = "Rate It Now";
  AppRate.preferences.openStoreInApp = true;
  AppRate.preferences.storeAppURL.android = 'market://details?id=com.my.project';
  AppRate.preferences.customLocale = customLocale;
  AppRate.preferences.displayAppName = 'My Project';
  AppRate.preferences.usesUntilPrompt = 1;
  AppRate.preferences.promptAgainForEachNewVersion = false;
  AppRate.promptForRating(true);
};

      </script>      
  </head>

  <body>
      <br><br>
      <button onclick="rateButton()">Rate</button>

  </body>

</html>

功能按钮(){
var customLocale={};
customLocale.title=“为该应用程序评分”;
customLocale.message=“如果您觉得这个应用程序有用,请将其评为5星!”;
customLocale.cancelButtonLabel=“不,谢谢”;
customLocale.laterButtonLabel=“稍后提醒我”;
customLocale.rateButtonLabel=“立即评级”;
AppRate.preferences.openStoreInApp=true;
AppRate.preferences.storeAppURL.android=market://details?id=com.my.project';
AppRate.preferences.customLocale=customLocale;
AppRate.preferences.displayAppName='我的项目';
AppRate.preferences.usesUntilPrompt=1;
AppRate.preferences.promptAgainForEachNewVersion=false;
通知、提示(真实);
};


比率

在android和ios设备上构建和工作,你必须更改AppRate.preferences.storeAppURL.android

多亏了krisrak。它起作用了

实际上,唯一缺少的是引用cordova.js的行

我不知道的是,cordova.js是在放入代码时自动生成的。我对XDK印象深刻。如果他们只在文档上投入更多的时间