在Facebook,Twitter和谷歌加其他应用程序打开页面 - 机器人 [英] Open page in Facebook,Twitter and Google Plus app from other app - Android

查看:143
本文介绍了在Facebook,Twitter和谷歌加其他应用程序打开页面 - 机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作,我需要整合不同社交网络的社交功能的应用程序:Facebook的,Twitter的,谷歌+

I'm working on an application where I need to integrate the social functionality of the different social networks: Facebook, Twitter, Google+.

目前,在Facebook和Twitter我什么用户拥有一个原生应用程序认可,如果他这样做,我打开它,并告诉他我的粉丝专页。

For now, in Facebook and Twitter i'm recognized if the user has a native application and if he does, I'm opening it and show him my fan page.

有关Twitter的我用的是下一个code:

For Twitter I use the next code:

try {

  Intent intent = new Intent(Intent.ACTION_VIEW,
        Uri.parse("twitter://user?screen_name=[user_name]"));
    startActivity(intent);

    }catch (Exception e) {
        startActivity(new Intent(Intent.ACTION_VIEW,
             Uri.parse("https://twitter.com/#!/[user_name]"))); 
    } 

和对于Facebook的下一个code:

And for Facebook the next code:

try{

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/" + PROFILE_FACEBOOK_APP_ID));
startActivity(intent);

}catch(Exception e){

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com/UserNamePage")));
}

现在我想要做同样的事情使用Google+。我看到了,我可以浏览到下一个网址 https://plus.google.com/MY_PAGE_ID/ 我的粉丝专页,但它不断地问我,如果我要开它与Google+相关应用程序或浏览器,我想他会自动打开它的应用程序,而不询问用户。

Now I want to do the same thing for Google+. I saw that I can browse to my fan page with the next Url https://plus.google.com/MY_PAGE_ID/, but it keep asking me if I want to open it with Google+ application or with the browser, and I want that he will open it with the application automatically, without asking the user.

有没有一种简单的方法来做到这一点? 谢谢你。

Is there a simple way to do this? Thanks.

推荐答案

找到了解决方法:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.google.android.apps.plus",
"com.google.android.apps.plus.phone.UrlGatewayActivity");
intent.putExtra("customAppUri", "FAN_PAGE_ID");
startActivity(intent);

这篇关于在Facebook,Twitter和谷歌加其他应用程序打开页面 - 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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