【发布时间】:2017-06-27 10:47:56
【问题描述】:
我正在使用PlusShare.Builder 将 URL 分享给 google plus,但它没有呈现。
当我简单地在 google plus 中复制粘贴 URL 时,它的渲染成功,但在 android 端它不起作用。
这是我的URL
请用我的代码指导我。我的代码中是否缺少任何东西。
private void shareToGooglePlus(String urlToShare){
PlusShare.Builder builder = new PlusShare.Builder(getActivity());
// Set call-to-action metadata.
builder.addCallToAction(
"CREATE_ITEM", /** call-to-action button label */
Uri.parse("http://plus.google.com/pages/create"), /** call-to-action url (for desktop use) */
"/pages/create" /** call to action deep-link ID (for mobile use), 512 characters or fewer */);
// Set the content url (for desktop use).
builder.setContentUrl(Uri.parse("https://plus.google.com/share?url="+ urlToShare));
// Set the share text.
builder.addStream(Uri.parse(urlToShare));
builder.setText(urlToShare);
startActivityForResult(builder.getIntent(), 0);
}
【问题讨论】:
标签: android google-plus sharing