在Facebook,Twitter和谷歌加其他应用程序打开页面 - 机器人机器人、应用程序、页面、Facebook

2023-09-04 22:58:27 作者:爱哭鬼丫头

我的工作,我需要整合不同社交网络的社交功能的应用程序: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);
 
精彩推荐
图片推荐