通过意图Android开放谷歌加页 [英] Open google plus page via intent in android

查看:132
本文介绍了通过意图Android开放谷歌加页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个谷歌网页<一href="https://plus.google.com/u/0/b/101839105638971401281/101839105638971401281/posts">https://plus.google.com/u/0/b/101839105638971401281/101839105638971401281/posts和一个机器人aplication。我想在我的应用程序打开该网页。我不希望打开浏览器!

I have a google page https://plus.google.com/u/0/b/101839105638971401281/101839105638971401281/posts and an android aplication. I want to open this page in my app. I don't want open the browser!

本打开浏览器

URL="https://plus.google.com/b/101839105638971401281/101839105638971401281/posts";
uri = Uri.parse(URL);
it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);

这崩溃!

Intent intent = new Intent(Intent.ACTION_VIEW);

intent.setClassName("com.google.android.apps.plus",             "com.google.android.apps.plus.phone.UrlGatewayActivity");

intent.putExtra("customAppUri", "10183910563897140128");
startActivity(intent);

在此先感谢!

Thanks in advance!

[求助]

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/101839105638971401281/posts")));

通过该解决方案,用户可以选择谷歌加应用程序或打开浏览器。如果选择的应用程序,这并不崩溃

With this solution the user can choose the Google Plus APP or open the browser. If choose the APP, this doesnt crash

推荐答案

如果用户已经安装了Google+应用程序,你可以这样做:

If the user has the Google+ app installed, you can do this:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/101839105638971401281/posts")));

注意URI的语法,而且它不包含 / B / ID /

这篇关于通过意图Android开放谷歌加页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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