Possible Duplicate:
Open Facebook page from Android app?
Does the Android Facebook app have Intents that other apps can use to start the Facebook app and goto a specific page?
For example, when someone clicks a certain button in my app, I want them to be taken to Facebook to a specific company's public Facebook page. Starting a web browser activity for this is easy, but more than likely the user is not logged in the browser etc...
I was thinking it would be nice if I could instead use an Intent (if one exists...) to start up the Facebook app and take the user to the specific page in the app. That way the user is already logged in and can interact with the page, Like it, etc...
Does an Intent like this exist? If so, where would I find more information on it? I've been looking through Facebook's developer documentation but I'm not seeing anything about this.
Use this method:
public static Intent getOpenFacebookIntent(Context context) {
try {
context.getPackageManager().getPackageInfo("com.facebook.katana", 0);
return new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/<id_here>"));
} catch (Exception e) {
return new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/<user_name_here>"));
}
}
This will open the Facebook app if the user has it installed. Otherwise, it will open Facebook in the browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With