I have a string message that I want to share on facebook's messenger app, but I cant find a working solution to do that? Can someone help me do this? Right now I have this code and its not working:
String mimeType = "text/*";
Uri contentUri = Uri.parse(getString(R.string.share_msg));
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setPackage("com.facebook.orca");
intent.setType(mimeType);
intent.putExtra(Intent.EXTRA_STREAM, contentUri);
intent.putExtra(EXTRA_PROTOCOL_VERSION, PROTOCOL_VERSION);
intent.putExtra(EXTRA_APP_ID, getString(R.string.share_msg));
startActivityForResult(intent, SHARE_TO_MESSENGER_REQUEST_CODE);
When I run this code Facebook messenger crashes with this logs:
Handling exception for crash
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.facebook.orca/com.facebook.messaging.sharing.ShareLauncherActivity}: java.lang.NullPointerException
Does anyone knows is it possible to share text content to facebook messenger and how can I do that?