Google中的应用活动

时间:2013-11-22 15:52:21

标签: android google-plus

我正在开发具有Google+功能的Android项目。我在这里读一篇文章:https://developers.google.com/+/mobile/android/app-activities

我理解以下代码示例:

ItemScope target = new ItemScope.Builder()
      .setUrl(targetUrl)
      .build();
Moment moment = new Moment.Builder()
      .setType("http://schemas.google.com/ReviewActivity")
      .setTarget(target)
      .setResult(result)
      .build();

但我不知道下面的代码, setUrl的目的是什么?

ItemScope rating = new ItemScope.Builder()
      .setType("http://schema.org/Rating")
      .setRatingValue("100")
      .setBestRating("100")
      .setWorstRating("0")
      .build();

ItemScope result = new ItemScope.Builder()
    .setType("http://schema.org/Review")
    .setName("A Humble Review of Widget")
    .setUrl("https://developers.google.com/+/web/snippet/examples/review")
    .setDescription("It is amazingly effective")
    .setReviewRating(rating)
    .build();

我已经看到链接的来源:https://developers.google.com/+/web/snippet/examples/review。它包含name,reviewRating,... 为什么我们需要“setname”,“setRatingValue”,....

<!DOCTYPE html>
<html>
<head>
  <title>A Review</title>
</head>
<body itemscope itemtype="http://schema.org/Review">
<section>Name: <div itemprop="name">A Humble Review of Widget</div></section>
<section>
  <a itemprop="url" href="https://developers.google.com/+/web/snippet/examples/review">
    A link to this review</a>
</section>
<section>
  Text:
  <p itemprop="text">It is amazingly effective at whatever it is that it is supposed to do.</p>
</section>
<section itemprop="reviewRating" itemscope itemtype="http://schema.org/Review">
  <span itemprop="worstRating">0</span> to <span itemprop="bestRating">100</span> rating: <span itemprop="ratingValue">100</span>
</section>
</body>
</html>

1 个答案:

答案 0 :(得分:2)

网址将是您网站上的一个页面,代表发生的具体活动。服务器上的页面应包含正在创建的活动的正确Schema.org标记。审阅示例只是一个示例,只要您符合Schema.org标准,就可以添加或删除所需的任何属性。