from my Android app, I would like to open a link to a Facebook profile in the official Facebook app (if the app is installed, of course). For iPhone, there exists the fb://
URL scheme, but trying the same thing on my Android device throws an ActivityNotFoundException
.
Is there a chance to open a Facebook profile in the official Facebook app from code?
I have created a method to open facebook page into facebook app, if app is not existing then opening in chrome
Utils.class add these method
and this
this is the simplest code for doing this
To launch facebook page from your app, let urlString = "fb://page/your_fb_page_id"
To launch facebook messenger let urlString = "fb-messenger://user/your_fb_page_id"
FB page id is usually numeric. To get it, goto Find My FB ID input your profile url, something like www.facebook.com/edgedevstudio then click "Find Numberic ID".
Voila, you now have your fb numeric id. replace "your_fb_page_id" with the generated Numeric ID
To do this we need the "Facebook page id", you can get it :
To opening facebook app on specified profile page,
you can do this:
Or you can validate when the facebook app is not installed, then open the facebook web page.
Answering this in October 2018. The working code is the one using the pageID. I just tested it and it is functional.