Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Share a text with facebook messenger?

Tags:

Is there a way to share a text in facebook messenger using android and maybe facebook sdk as well?

I want to make something like the whatsapp way, choose your text and open an intent to choose the guy you want to send to... Is there a way to do this with facebook messenger? It appears in the intent.choose dialog..but I only want to send to facebook messenger..

like image 588
Boldijar Paul Avatar asked Sep 29 '14 13:09

Boldijar Paul


1 Answers

use this code onClick,,

com.facebook.orca is the package name for fb messenger.

    Intent sendIntent = new Intent();     sendIntent.setAction(Intent.ACTION_SEND);     sendIntent             .putExtra(Intent.EXTRA_TEXT,                     "<---YOUR TEXT HERE--->.");     sendIntent.setType("text/plain");     sendIntent.setPackage("com.facebook.orca");     try {         startActivity(sendIntent);     }     catch (android.content.ActivityNotFoundException ex) {         Toast.makeText(context,"Please Install Facebook Messenger", Toast.LENGTH_LONG).show();     } 
like image 61
Dhinakaran Thennarasu Avatar answered Oct 05 '22 11:10

Dhinakaran Thennarasu