Skip to content

Instantly share code, notes, and snippets.

@darwind
Created March 14, 2015 20:16
Show Gist options
  • Save darwind/773f6abf703b5ec18583 to your computer and use it in GitHub Desktop.
Save darwind/773f6abf703b5ec18583 to your computer and use it in GitHub Desktop.
Android: sharing photos to Facebook
Uri myImageContentUri; // A content Uri to the image you would like to share.
String myAppId = "<Your_Facebook_App_Id>";
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, myImageContentUri);
// Include your Facebook App Id for attribution
shareIntent.putExtra("com.facebook.platform.extra.APPLICATION_ID", myAppId);
startActivityForResult(Intent.createChooser(shareIntent, "Share"), myRequestId);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment