Facebook SDK & Graph API

Introduction to Facebook SDK & Graph API, and what to do when a Graph API version is to be deprecated.

Introduction to Facebook SDK & Graph API, and what to do when a Graph API version is to be deprecated.

Original Chinese version by Zhang Chi from FF client dev team
Translated & rewritten by Li Shen from GOP

Objective

There are times when developers receive alerts like below in Facebook Developer Center, warning that a certain version of Graph API is to be deprecated and some APIs might not work after being forced to upgrade to the next earliest available version of Graph API.

This doc aims to explain what this alert is about, and how it should be dealt with.

About Graph API

Graph API is the primary way to get data into and out of the Facebook platform. It’s an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks, from both app clients and servers.

Each version of Graph API is to be deprecated 2 years after the release of its next version. You can find out the oldest supported version and its starting time in Graph API Upgrade Tool.

For example, the screenshot below indicates that v3.2 will be the oldest supported version in between Oct 27, 2020 and May 4, 2021.

About Facebook SDK

Facebook SDK (FB SDK or FBSDK) can be integrated selectively by 3rd party apps to utilize Facebook account related functions such as logging-in, getting user info, posting images or links, etc.

FB SDK communicates with Facebook services using Graph API. Each version of FB SDK has its determined version of Graph API, which nevertheless, is overwritten by the version designated in Developer Center - Settings - Advanced where it can be upgraded directly without any client release to a targeted newer version.

However, if the API Upgrade tool suggests any changes between the FBSDK’s supported(original) version of Graph API and the intended version you target to upgrade to, this FBSDK should no longer be implemented and you are strongly suggested to use a verstion that supports a higher version of Graph API.

Version Mapping: FBSDK and Graph API

The latest versions of FBSDK can be found in GitHub, and any implementation of an upgraded version of Graph API is mentioned in the change logs.

Older versions can be found here:

For Android app developers, you can also download from GitHub and then unzip the dependent library (should be some .aar files), and then decompile the classes.jar file and search for keyword in its Java source code for the Graph API version.

GOP and Garena MSDK (GMSDK) Interact with Facebook Services

GOP Server uses Graph API to obtain user information e.g. profile picture, friend list;
Through FBSDK, GMSDK calls Graph API for events such as account login, sharing to Facebook, etc.

Version Mapping: GMSDK and FBSDK

The versions of GMSDK can be found in Garena Deverloper Doc site (requiring host binding to visit), and any upgrade of FBSDK is mentioned in the change logs.

iOS GMSDK includes FBSDK with a compiled framework which cannot be altered. Therefore the FBSDK version is fixed.

Different from iOS, Android GMSDK is released with source code, and FBSDK is used remotely as Gradle, meaning app developers can change the version of FBSDK in a given version of GMSDK. Note that there is a risk of compatibility issues and this alteration is not encouraged.

What shall Developers do after receiving alerts about a Graph API version to deprecate?

  1. Check if your app is using the deprecating version of Graph API from Facebook Developer Center - Settings - Advanced - Upgrade API Version.
  • If the version is higher than the deprecating one, you should not be worrying.
  • If the version is the deprecating one, check if your FB SDK version already supports a newer version of Graph API (Refer to Version Mapping: FBSDK and Graph API).
    – If yes, then no worries;
    – If not, then perform the following steps:
  1. Decide a target version of Graph API that is newer than the deprecating one.
    To do this, use Facebook’s API Upgrade Tool to check if any of the methods used by your app is affected in between two Graph API versions (your current version, and a target version).
  • If the “number of upcoming changes” is 0 for all methods, then there should be no worries and you can proceed to steps 3 & 4.
  • If any is not 0, then you will need to consider:
    – Lower the ‘Upgrade to’ target version if possible;
    – Upgrade your app to use a newer version of FB SDK/Garena MSDK (See “Version Mapping: GMSDK and FBSDK”) that supports a higher version of Graph API.
    – You can also confirm your app’s FB SDK Version in Settings - Advanced - Check Your SDK Version

  1. In Facebook Developer Center - Settings - Advanced, upgrade the API to target version for developer users to test compatibility (“Upgrade Calls for App Roles”).

  2. Test Facebook related functions in your app using the test user accounts.

  3. After testing is passed, upgrade the API to target version for all users.

  4. If you do not make the step 5 changes by the date the current version will be deprecated, it will be automatically upgraded to the oldest supported version then.

  5. Please contact GOP if you have any questions in this process.

References

Garena MSDK Developer Doc http://developer.garena.com/docs/
Platform Versioning https://developers.facebook.com/docs/apps/versions
Graph API Version Upgrade Guide https://developers.facebook.com/docs/apps/upgrading