我正尝试在 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/