The built-in Facebook plugin SDK instance exposes the following APIs.
Getting the Facebook instance
When a project uses the Facebook plugin, the ObjectClass
for it can be looked up using the runtime method GetSingleGlobalObjectClassByCtor(C3.Plugins.Facebook)
. From there the single-global instance can be obtained and then the SDK instance, which exposes the API below. Note that if the Facebook plugin is not present in the project then GetSingleGlobalObjectClassByCtor()
will return null
. The code sample below demonstrates how to access the Facebook plugin instance from another addon.
const facebookObjectClass = this._runtime.GetSingleGlobalObjectClassByCtor(C3.Plugins.Facebook);
if (facebookObjectClass)
{
const facebookSdkInst = facebookObjectClass.GetSingleGlobalInstance().GetSdkInstance();
// can now make calls, e.g.: facebookSdkInst.GetAccessToken()
}
Available APIs
- GetAccessToken()
- Return a string of the Facebook login access token. This is available once the On user logged in trigger fires. The access token can be used to make additional Facebook API calls on behalf of the user.
Addon SDK Manual
Construct.net
2018-11-12
2018-11-12