【问题标题】:Open Graph Tag for Google+ in Android application在 Android 应用程序中为 Google+ 打开图形标签
【发布时间】:2014-07-11 06:01:34
【问题描述】:

我正在尝试在 Google+ 上发布来自 Android 应用程序的 URL。 此 URL 具有 OgTags,但无法获取内容,包括标题、图像或描述。

有人有维修的想法吗?

这是网址的代码:

<!DOCTYPE html>
<html lang="fr-FR" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#" class="no-js">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="robots" content="noindex,follow"/>
<meta property="og:locale" content="fr_FR" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Test Title" />
<meta property="og:description" content="Test description" />
<meta property="og:url" content="http://www.test.com/test" />
<meta property="og:site_name" content="Test name" />
<meta property="article:published_time" content="2013-11-29T17:09:55+00:00" />
<meta property="article:modified_time" content="2014-05-21T10:05:55+00:00" />
<meta property="og:updated_time" content="2014-05-21T10:05:55+00:00" />
<meta property="og:image" content="test_content.png" />

这是构建请求的代码:

public GooglePlusHelper(Activity context) {
    mActivity = context;
    mPlusClient = new PlusClient.Builder(mActivity, this, this)
    .setActions("http://schemas.google.com/AddActivity", "http://schemas.google.com/ReviewActivity")
    .setScopes("PLUS_LOGIN") // Space separated list of scopes
    .build();
}

public void connect() {
    mPlusClient.connect();
}

public void disconnect() {
    mPlusClient.disconnect();
}

/**
 * Open Google+ to share a link
 * 
 * @param message
 * @param link
 */
public void shareUrl(String message, String link) {
    if (!Tools.hasNetworkConnection(mActivity)) {
        AlertHelper.displayInternetRequired(mActivity);
        return;
    }
    Intent shareIntent = new PlusShare.Builder(mActivity)
    .setType("text/plain")
    .setText(message)
    .getIntent();
    if (mActivity.getPackageManager().queryIntentActivities(shareIntent, PackageManager.MATCH_DEFAULT_ONLY).size() > 0) {
        mActivity.startActivityForResult(shareIntent, SHARE_REQUEST);
    } else {
        AlertHelper.displayGooglePlusRequired(mActivity, new Runnable() {

            @Override
            public void run() {
                mActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(mActivity.getString(R.string.uri_app_market) + "com.google.android.apps.plus")));
            }
        });
    }
}

我称之为:

mGooglePlusHelper.shareUrl("Go share it !", "http://www.test.com/test");

谢谢

【问题讨论】:

    标签: android google-plus facebook-opengraph


    【解决方案1】:

    http://www.test.com/test 只是进行重定向,所以我猜这不是您的实际页面。共享的页面必须可以在 Internet 上公开访问,以便 Google 的服务器获取和解析它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多