【发布时间】:2014-03-10 05:09:51
【问题描述】:
大家好,当我尝试将一些信息从我的 Android 应用程序发布到 Google Plus 时遇到问题,我必须分享的代码如下:
public void shareOnGooglePlus(Activity activity, String caption)
{
PlusShare.Builder builder = new PlusShare.Builder(activity);
// 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/pages/"));
// Set the target deep-link ID (for mobile use).
builder.setContentDeepLinkId("/pages/", null, null, null);
// Set the share text.
builder.setText(caption);
activity.startActivityForResult(builder.getIntent(), 0)
}
当按钮共享被按下并显示以下对话框时调用此方法:
然后当我按下分享时,会出现以下对话框:
在 AndroidManifest 我有以下权限:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
还有:
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
最后在 Android 控制台我发现了以下消息:
03-10 16:00:51.033 2012-2017/? E/MP-Decision﹕ num online cores: 2 reqd : 3 available : 4 rq_depth:3.300000 hotplug_avg_load_dw: 54
03-10 16:00:51.033 2012-2017/? E/MP-Decision﹕ UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:0.000000
03-10 16:00:51.033 2012-2017/? E/MP-Decision﹕ UP cpu:2 core_idx:2 Nw:2.700000 Tw:90 total_time_up:98.000000
03-10 16:00:51.673 1463-2123/? E/Volley﹕ [90] sm.a: Unexpected response code 400 for https://www.googleapis.com/plus/v1whitelisted/people/me/activities?language=en-AU¬ifyCircles=false&preview=false&shareOnGooglePlus=true
03-10 16:00:51.673 1463-18889/? E/InsertActivityOperation﹕ null
sg
at sm.a(SourceFile:145)
at rq.run(SourceFile:105)
03-10 16:00:51.783 696-1212/? E/EnterpriseContainerManager﹕ ContainerPolicy Service is not yet ready!!!
提前致谢!
【问题讨论】:
标签: android google-plus