Open Google Plus Page Via Intent In Android

Viewed 13688

I have a Google Plus page

https://plus.google.com/u/0/b/101839105638971401281/101839105638971401281/posts

and an Android application. I want to open this page in my app. I don't want to open the browser!

This opens the browser:

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

this crashes:

 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!

[SOLVED]

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 the APP is chosen, there is no crash.

6 Answers
public void openTwitter(String twitterName) {
    try {
       startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("twitter://user?screen_name=" + twitterName)));
    } catch (ActivityNotFoundException e) {
       startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("https://twitter.com/#!/" + twitterName)));
    }
}
Related