I\'m trying to use some code from SO but it fails:
Those are uri\'s supposed to open the right section of the app.
facebook://facebook.com/info?user=
Actually it looks like this. These URIs only work with the most recent version of the facebook app. That's why we try catch.
public static Intent getOpenFacebookIntent(Context context) {
try {
context.getPackageManager()
.getPackageInfo("com.facebook.katana", 0); //Checks if FB is even installed.
return new Intent(Intent.ACTION_VIEW,
Uri.parse("fb://profile/254175194653125")); //Trys to make intent with FB's URI
} catch (Exception e) {
return new Intent(Intent.ACTION_VIEW,
Uri.parse("https://www.facebook.com/arkverse")); //catches and opens a url to the desired page
}
}
In your Activity, to open it, call it like so:
Intent facebookIntent = getOpenFacebookIntent(this);
startActivity(facebookIntent);
There are so many question about this but this code is worked for me.Facebook changed there policy so for more detail please check this Facebook official GRAPH API EXPLORER PAGE
Intent intent = null;
try {
getPackageManager().getPackageInfo("com.facebook.katana", 0);
String url = "https://www.facebook.com/"+idFacebook;
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://facewebmodal/f?href="+url));
} catch (Exception e) {
// no Facebook app, revert to browser
String url = "https://facebook.com/"+idFacebook;
intent = new Intent(Intent.ACTION_VIEW);
intent .setData(Uri.parse(url));
}
this.startActivity(intent);
For facebook page use like this: http://fb://page/87268309621xxxx For personal id use like this: http://fb://profile/87268309621xxxx
This no longer works
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/someProfile"));
Please try this instead
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://facewebmodal/f?href=https://www.facebook.com/someProfile"));
For now it is not possible, Facebook has been removed this functionality
To do this we need the "Facebook page id", you can get it :
you can do this:
String facebookId = "fb://page/<Facebook Page ID>";
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(facebookId)));