Search code examples
androidfacebookandroid-intentandroid-sharing

Trying to share the video link with facebook but it is showing Facebook App not installed


share_intent = new Intent(Intent.ACTION_SEND);
share_intent.setType("text/plain");
share_intent.setPackage("com.facebook");
share_intent.putExtra(Intent.EXTRA_TEXT, "https://www.youtube.com/watch?v=" + videoid);
try {
        mContext.startActivity(share_intent);
    } catch (android.content.ActivityNotFoundException ex) {
          Toast.makeText(mContext,"Facebook have not been installed.",Toast.LENGTH_SHORT).show();
      }

I' m trying to share the youtube video link from my app to facebook app but when I press on facebook share button it shows Facebook have not been installed.

Help me to find the solution. Any help will be appreciated. Thanks!


Solution

  • share_intent.setPackage(share_appname);: share_appname should contain the pcakage name of the application, you want to handle the intent. As you said in comment, you are using com.facebook as a package name, but facebook application has different package name: com.facebook.katana. You can check package name at google play market page of the application (in web browser): https://play.google.com/store/apps/details?id=com.facebook.katana