Jump to content
  • Advertisement
  • entries
  • comments
  • views

Introducing new Facebook “v4a” plugin

Sign in to follow this  


Similar to the recent updates we made to the Google IAP plugin to help combat “App Not Responding” (ANR) reports in the Google Play console, we have released an updated Facebook v4a plugin to reduce the incidence of ANR errors. Here’s what you need to know…

Why a new updated plugin?

The last revision of the Facebook plugin begins initialization when you first require() it, and it does not return to the calling module until initialization is complete. On Android devices, this may appear (to Google) that the application isn’t responding, thus generating an ANR report.

To solve this, we have made the new Facebook v4a plugin asynchronous. The new process involves starting the initialization when you require the plugin, plus a new facebook.init() API to register a listener to be called when the initialization process completes.

Using the new plugin

To use the new plugin version, you need to do four things:

  1. Change your build.settings code to use the new plugin. Simply change "plugin.facebook.v4" to "plugin.facebook.v4a".
  2. Change any Lua file that requires the plugin to use the new plugin. Simply change require("plugin.facebook.v4") to require("plugin.facebook.v4a").
  3. Make sure you’re using Corona version 2017.3068 or later (2017.3068 is the most recent public release at the time of this writing).
  4. Following the first time you require() the plugin, likely within main.lua, add a call to facebook.init().

New initialization API

Since the new Facebook v4a plugin is asynchronous, you need to know when initialization is actually complete. Calling the new facebook.init() API gives you a chance to define a specific function which will be called when initialization completes. Once that function receives the "fbinit" event, you can safely call other Facebook API calls like facebook.publishInstall() or facebook.login() (although you should probably defer asking the player to log in until a point in your game which makes sense).

The listener function referenced in facebook.init() will also be used for other Facebook API calls to handle "fbconnect" events. Because of this, you only need to call facebook.setFBConnectListener() if you wish to use a different function to process your "fbconnect" events. See the integration documentation for more information and examples.


While this update only truly affects Android builds, you should follow similar behavior for iOS builds to maximize cross-platform compatibility. ANRs can be a silent error that you may never know about, so we strongly encourage you to update to the Facebook v4a plugin, especially if you have an active Android user base.

View the full article

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!