Sharing for Android Devices

In order to better support sharing on TVs, the Facebook SDK for Android has built-in support for Facebook Sharing for Devices. This sharing does not require Facebook Login and is ideal for TV environments because it doesn't require using the remote.

You can share links via ShareLinkContent or open graph stories via ShareOpenGraphContent.

Step 1. Use DeviceShareButton or DeviceShareDialog

Use the Device Share Button to provide a share button that triggers the Sharing for Devices flow.

ShareLinkContent content =
  new ShareLinkContent.Builder()
  .setContentUrl(
    Uri.parse("https://developers.facebook.com/docs/android/devices"))
  .build();

DeviceShareButton button = (DeviceShareButton)view.findViewById(R.id.share_button);
//button.setFragment(this); //optional setter if the instance is in a fragment and you want to register a callback.
button.setShareContent(content);

Or programmatically present the Sharing for Devices dialog using a Device Share Dialog.

DeviceShareDialog dialog = new DeviceShareDialog(this);
dialog.show(content);

Step 2. Registering Callbacks

Both the he Device Share Button and the Device Share Dialog support callback registration, like other buttons and dialogs in the Facebook Sharing for Android guide.

However, device sharing never returns information about whether the person actually completed the share. Therefore, the callback will always receive an onSuccess, indicating only that the person closed the share dialog, or onError, indicating that the sharing flow was interrupted.