android - 在 Android 应用程序中为 Google+ 打开图标签

标签 android google-plus facebook-opengraph

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

有人有修复它的想法吗?

这是 URL 的代码:

<!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");

谢谢

最佳答案

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

关于android - 在 Android 应用程序中为 Google+ 打开图标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23802762/

相关文章:

android - phonegap 媒体错误代码 0

android - 使用带有 minifyEnabled 的 SimpleXML 的应用程序不起作用

android - 如何在死线程警告中修复向处理程序发送空消息的问题?

android - 如何在 Android 中获取 Google+ 好友

Facebook Open Graph 不清除缓存

android - 进度条在 Swiperefreshlayout 中显示更大

javascript - 仅使用访问 token 在 Node 中获取 google+ 用户配置文件

java - Android 应用程序中的 Google Plus 集成

wordpress - 从 Open Graph 中排除图像

java - Facebook Android 开放图谱