Android的 - Google+分享状态​​失败 [英] Android - Google+ share status fails

查看:161
本文介绍了Android的 - Google+分享状态​​失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我去了谷歌对如何从我的Andr​​oid应用程序与Google+共享的状态描述:的 https://developers.google.com/+/mobile/android/share/
(我在做一个例子应用程序,不正是他们在做这个例子是什么)

I went over the Google's description on how to share status from my Android app to Google+: https://developers.google.com/+/mobile/android/share/
(I'm doing an example app that does exactly what they do in the example)

我得到这个异​​常:

Process: com.google.android.gms.ui, PID: 19643
java.lang.IllegalArgumentException
        at com.google.k.a.aj.a(SourceFile:72)
        at com.google.android.gms.plus.audience.a.e.<init>(SourceFile:63)
        at com.google.android.gms.plus.audience.a.e.<init>(SourceFile:53)
        at com.google.android.gms.plus.audience.a.d.<init>(SourceFile:28)
        at com.google.android.gms.plus.sharebox.al.a(SourceFile:213)
        at android.support.v4.app.ax.c(SourceFile:490)
        at android.support.v4.app.ax.d(SourceFile:499)
        at android.support.v4.app.ax.b(SourceFile:646)
        at com.google.android.gms.plus.sharebox.al.a(SourceFile:192)
        at com.google.android.gms.plus.sharebox.ShareBoxActivity.a(SourceFile:525)
        at com.google.android.gms.plus.sharebox.au.a(SourceFile:810)
        at com.google.android.gms.plus.internal.ce.a(SourceFile:214)
        at com.google.android.gms.common.internal.v.d(SourceFile:200)
        at com.google.android.gms.common.internal.u.handleMessage(SourceFile:136)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5221)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

它似乎错误是从内部谷歌播放服务来,但我不知道为什么?

It's seems that the error is coming from within "Google Play Services" but I don't know why?

想法?

推荐答案

我看到使用谷歌播放的,服务71年6月1日这同样的错误。埃杜巴尔巴斯上面有正确答案,用ShareCompat.IntentBuilder似乎解决问题。我没有足够的积分,他的回答发表评论,但我想补充一点,共享活动的目的和出发的建设是有一点不同:

I see this same error using google-play-services 6.1.71. Edu Barbas above has the correct answer, using ShareCompat.IntentBuilder seems to resolve the issue. I don't have enough points to comment on his answer, but I wanted to add that the building of the intent and starting of the share activity is a little different:

      Intent shareIntent = ShareCompat.IntentBuilder.from(TheCurrentActivity.this)
                .setType("text/plain")
                .setText(statusMessage)
                .getIntent()
                .setPackage("com.google.android.apps.plus");

        startActivityForResult(shareIntent, 0);

离开关setPackage(com.google.android.apps.plus)行带来了一个普遍的Andr​​oid份额对话框,允许您通过电子邮件,蓝牙,和短信分享,除了谷歌加。添加setPackage行允许你绕过该对话框,并通过谷歌加分享专。

Leaving off the setPackage("com.google.android.apps.plus") line brings up a general android share dialog, allowing you to share via email, bluetooth, and sms, in addition to google plus. Adding the setPackage line allows you to bypass that dialog and share exclusively through google plus.

这篇关于Android的 - Google+分享状态​​失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆