-2

Consider:

dataTextView.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {

        Intent facebookIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/app_scoped_user_id/1149231332XXXX/"));
        startActivity(facebookIntent);
    }
});

But it always open this URL in the browser instead of the app.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mehul Santoki
  • 1,208
  • 1
  • 12
  • 25

1 Answers1

1

Check out https://graph.facebook.com/ (https://graph.facebook.com/fsintents for instance).

public static Intent openInFBApp(Context context) {
    try {
        context.getPackageManager().getPackageInfo("com.facebook.katana", 0);
        return new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/<id_here>"));
    } catch (Exception e) {
        return new Intent(Intent.ACTION_VIEW,Uri.parse("https://www.facebook.com/<user_name_here>"));
    }
}
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Prakhar Singh
  • 206
  • 1
  • 13