Skip to content

Instantly share code, notes, and snippets.

@mdsami
Created March 8, 2020 17:44
Show Gist options
  • Select an option

  • Save mdsami/b67c90cdd39d5a6b3b5be97a420efc15 to your computer and use it in GitHub Desktop.

Select an option

Save mdsami/b67c90cdd39d5a6b3b5be97a420efc15 to your computer and use it in GitHub Desktop.
Abdroid Fb messger chat
public static void invokeMessenger(Activity activity) {
try {
if (AppUtils.isPackageInstalled(activity.getApplicationContext(), "com.facebook.orca")) {
/**
* get id of your facebook page from here:
* https://findmyfbid.com/
*
* Suppose your facebook page url is: http://www.facebook.com/hiponcho
*
* Visit https://findmyfbid.com/ and put your url and click on "Find Numeric Id"
* You will get and ID like this: 788720331154519
*
* Append an extra 'l' with the number and please
* bellow. This is not 1 (one), this is l (l for long)
* So, final ID: 788720331154519l
*/
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("fb://messaging/" + 788720331154519l))); // replace id
} else {
AppUtils.showToast(activity.getApplicationContext(),
activity.getApplicationContext().getResources().getString(R.string.install_messenger));
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=com.facebook.orca")));
}
} catch (Exception e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment