问题描述:

I'm trying to post a URL from an Android application on Google+.

This URL has OgTags but there are unable to fetch content, neither the title, the image or the description.

Does anybody have an idea for repair it ?

Here's the code of the 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" />

And here's the code for builing the request :

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

}

});

}

}

And I call this with :

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

Thanks

网友答案:

http://www.test.com/test just does a redirect so I'm guessing that's not your actual page. The page shared has to be publically accessible on the internet for Google's servers to fetch and parse it.

相关阅读:
Top