I want to open facebook messenger by code. How I can get the facebook ID?? I have the facebook SDK on my app and I saved for every user the facebookId but is not the same as I need
Here is my method:
// Make sure the Facebook Messenger for Android client is installed
boolean isFBInstalled = isAppInstalled("com.facebook.orca");
if (!isFBInstalled) {
Toast.makeText(this,"Facebook messenger isn't installed. Please download the app first.", Toast.LENGTH_SHORT)
.show();
}
else {
// Create the Intent
Uri uri = Uri.parse("fb-messenger://user/");
uri = ContentUris.withAppendedId(uri,Long.valueOf(facebookIDhere);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
try {
startActivity(intent);
}
catch(Exception e) {
Toast.makeText(this,"Oups!Can't open Facebook messenger right now. Please try again later.", Toast.LENGTH_SHORT)
.show();
}
}
return;