在Android应用中打开Goog​​le+的图表标记

时间:2014-05-22 09:25:44

标签: android google-plus open-graph-protocol

我试图在Google+上发布Android应用中的网址。 此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");

由于

1 个答案:

答案 0 :(得分:0)

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

相关问题