It’s really a good idea to include the link to your Facebook page in the Android app. It will help you to keep in touch with the users of your app.
Below is the code you should put in the click event of the “Like Us on Facebook” button.
String fbPageId = "149483785425721"; String fbPageUrl = "https://www.facebook.com/bmicalculatorapp"; try { getPackageManager().getPackageInfo("com.facebook.katana", 0); Intent fb = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/" + fbPageId)); startActivity(fb); } catch (Exception e) { Intent fb = new Intent(Intent.ACTION_VIEW, Uri.parse(fbPageUrl)); startActivity(fb); }
You just need to replace the fbPageId and fbPageUrl in above code. You can find the page id of your Facebook page in Your Page -> Settings -> Page Info section.