Google+使用WebView共享分享

时间:2012-09-02 08:35:09

标签: android webview android-activity

在Android应用中,我希望使用您通过导航至以下方式调用的Google+共享API:

https://plus.google.com/share?url=...

如果我的应用程序启动了这样的活动;

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(theUrl);
startActivity(intent);

然后创建了一个浏览器,我在Google +中看到了我的帖子。

另一方面,如果我尝试创建这样的活动:

Intent intent = new Intent();
intent.setData(theUrl);
intent.setClass(this,GoogleActivity.class);
startActivity(intent);

其中GoogleActivity是onCreate()实例化的Activity WebView,WebView加载通过intent传递的url, 事情不起作用。我看到了WebView,它进入了允许的页面 我分享提到的网址。我可以点击“分享”按钮 在Google+中,然后查看我的Google+信息流,就像我在启动时一样 浏览器。但是我没有在流中看到我的共享链接!

为什么这两种情况会有所不同?

1 个答案:

答案 0 :(得分:0)

问题解决了。这个问题与WebView无关。

我的Android浏览器使用一个帐户登录Google,而WebView正在使用另一个帐户。 D'哦。

WebView非常适合其使用的帐户。