Sharing for Native Apps

Expand your player base with socially driven, organic engagement. Sharing for Gaming enables game content to be shared broadly across Facebook and Instagram.

Sharing for Gaming surfaces your game content for sharing among players and their Facebook friends. Users can share screenshots and video clips of their gameplay to Instagram and Facebook, including Stories and Facebook Groups, which helps players build meaningful communities around the games they play.

Sharing for Gaming User Experience

Requirements

Sharing for Gaming is part of the suite of Gaming Services. Your application needs to enroll in Gaming Services to access features in this document. Follow the instructions to enroll your application.

Supported Sharing Surfaces

When a user is presented with the Share dialog, one or more of the following options will be available depending on what they have installed:

Facebook

Share to Your Feed

  • Available on Facebook Mobile Web, Android, iOS
  • Facebook App Composer opens to share the content

Share to Your Story

  • Available on Android, iOS
  • Opens Facebook Story Composer

Instagram

Share to Your Feed

  • Available on Android, iOS
  • Opens Instagram Feed Composer

Share to Your Story

  • Available on Android, iOS
  • Opens Instagram Story Composer

Download

  • Available on Facebook Mobile Web, Android, iOS
  • Download the content to user device

Technical Implementation

Configuration

The full share flow is:

  1. Asset upload
  2. App-switch to the Facebook Gaming Activity Share Dialog
  3. Edit and share
  4. App-switch back to the App

We rely on your platform Settings > Basic > iOS/Android package settings and Deep Linking to enable switching back to your App. Make sure the Deep Linking option is enabled and that each relevant store and bundle is correctly configured per platform.

Please note that app switching is currently only available for shares on the Facebook App.

SDK

We recommend using the latest Facebook SDK, which supports Facebook Login for Gaming and Sharing for Gaming. It also ensures user can see the Share Experience after uploading. Follow the sample code below:

You can also choose to build your own sharing flow using the following APIs and methods to upload and perform an app switch from your app:

Upload Photos and Videos

Follow the instructions on the Facebook Photo Uploading page. Keep in mind:

  • Photo uploading only supports single photo uploads
  • Image URL must be linked to the Image file
  • Image Description Field would be surfaced when sharing, so please be mindful of this and use the caption that matches current user’s main language

For Video, uploading instructions and examples can be found in the Facebook Video Upload Graph API docs.

Command Line Upload Examples

This would not show Sharing Experience automatically.

// 1. Uploading photo with URL
curl -i -X POST \
> -d "url=https://www.facebook.com/images/fb_icon_325x325.png" \
> -d "caption=test photo upload" \
> -d "access_token=%ACCESS_TOKEN%" \
> "https://graph.facebook.com/v7.0/me/photos"
// 2. Uploading photo with local file
$ curl -X POST \
> "https://graph.facebook.com/v7.0/me/photos" \
> -F "source=@/path/to/picture.png" \
> -F "access_token=$ACCESS_TOKEN" \
> -F "caption='test_photo_upload'"   

An example of a successful photo upload will receive a response like this:

{"id": "10153677042736789"}
    

Deep Link for Sharing Dialog

You can use a provided deep link to allow the user to quickly navigate to the Media Library after an upload is completed in-app. If you are using SDK function call to upload the image, then this step is not needed.

The URL for the deep link is:

https://fb.gg/me/media_asset/{id}
Value of {id}DescriptionDeep Link Behavior

returned_id

The identifier returned after the API asset upload step above.

Opens Facebook App with the targeted uploaded media and its sharing destination

app_id

The app_id of the uploaded media

Opens Facebook App with a full list of user's current uploaded media.

Synchronous Share Flow for Photos

To building a synchronous share flow for image sharing:

  1. Upload image assets using the /me/photos API
  2. Deep link into the Facebook App and invoke the Share Dialog with the media asset id

Both of these steps are covered above.