How to display Facebook pages in the Android app

Asked 2 years ago, Updated 2 years ago, 100 views

I want to open a Facebook profile page on my app. Instead of just opening a site, I want to open it through Facebook's official app You can say *fb:// * on an iPhone. I did that on Android There was an ActivityNotFoundException. Is there any way?

android facebook url-scheme

2022-09-22 13:17

1 Answers

String facebookID = "OOOOOOOOOOOOOOOO";

try
{
    Uri uri = Uri.parse( "fb://page/" + facebookID );
    startActivity( new Intent( Intent.ACTION_VIEW, uri ) );
}
catch ( Exception e )
{
    Intent i = new Intent( Intent.ACTION_VIEW );
    Uri u = Uri.parse( "http://www.facebook.com/" + facebookID );
    i.setData( u );
    startActivity( i );
}

I think you can do it like this.


2022-09-22 13:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.