コード例 #1
0
 public HashMap<String, String> createPersonalizationRequest() {
   HashMap<String, String> map = new HashMap<>();
   map.put("news", Util.toJson(NewsArticleVector.getInstance().getRemaining()));
   map.put("user_info", Util.toJson(userProfile));
   map.put("num_articles", "" + NewsArticleVector.getBatchArticlesToShow());
   map.put("device_id", deviceId);
   return map;
 }
コード例 #2
0
  public void sendFeedback(String list1, String list2) {
    HashMap<String, Object> payload = new HashMap();
    payload.put("user_info", Util.toJson(userProfile));
    payload.put("device_id", deviceId);

    String url;
    // Emma's server
    if (list1 != null) {
      payload.put("news_feedback", list1);
      url =
          Util.loadConfigAssets(mApp, Constants.CONFIG_NEWS_PROPERTIES)
              .getProperty(Constants.CONFIG_FEEDBACK_MULTIBANDIT_LEARNING);
      HttpController.getHttpPostResponse(url, payload, null, 0);
    }

    // William's server
    if (list2 != null) {
      payload.put("news_feedback", list2);
      url =
          Util.loadConfigAssets(mApp, Constants.CONFIG_NEWS_PROPERTIES)
              .getProperty(Constants.CONFIG_FEEDBACK_LEARNING_FROM_ADVISE);
      HttpController.getHttpPostResponse(url, payload, null, 0);
    }
  }