FAQ IconIt’s Wednesday and time for another frequently asked questions (FAQs) session. Below are answers to popular questions on Corona Plugins.

1. How do I use Corona Plugins?

Corona Plugins are generally written by third party partners and hosted on the Corona servers. Plugin modules are downloaded for the Corona Simulator when a project is opened which specifies that the plugin is needed for the project. This is done by adding code to the build.settings file to tell the Corona server to include the plugin code. When the project is open and a local copy of the plugin exists, the simulator checks the Corona server to see if a newer version of the plugin exists and downloads it if needed.

You also need to add the “require” statement to the main.lua file to pull in the plugin code.

Not all plugins work in the Corona Simulator. If a plugin is not supported in the simulator, a “stub” file is loaded and a warning message displayed in the terminal window indicating that the plugin is not available for the simulator. In this case, you need to build the project for a device or the Xcode simulator to test the plugin.

There are sample projects for each of the plugins to help you get started. You can find a list of the plugins here.

2. I’m getting the following error when building a plugin: “You are not currently subscribed to the following plugin.” What does this mean?

Not all plugins are available to Starter users. If you have a Starter account and try to load a Pro-only plugin, you will see this error message.

Not Subscribed plugin error

You can check a plugin’s availability on the plugin’s respective API page.

Zip plugin API page

3. I’m getting a “Get Plugin Failed.” What does this mean?

This error occurs when the plugin isn’t available for the platform. One example is the iAds plugin, which is only available for iOS builds. If you build the plugin for Android, you will see this error.

Get Plugin Failed message

Again, the plugin’s API page will list the available platforms supported by the plugin.

Plugin Availability API page

4. How do I know the plugin is up to date?

When a plugin project is opened, the Corona Simulator checks to see if the simulator has an up-to-date copy of the plugin code. It will download the code if it doesn’t exist or a newer version exists on our servers. The downloaded plugin is only used by the simulator and is not used when building a project. When you build a project for a specific platform, the latest plugin code is linked into your project from our servers.

Some plugins can only be used starting with a specific build number. Check the plugin’s API page for the supported build number.

There is currently one issue that we are looking at concerning plugins. It’s possible for a plugin vendor to update a plugin and have it replace the existing plugin. Currently, we don’t have any thing in place that allows you to use a specific plugin version. We understand that this could be an issue in the future and looking into ways we can provide access to previous plugin versions.

5. I don’t want to keep editing my build.settings file when building for different platforms. Can I control what plugins are used for specific platforms?

You can add the supportedPlatforms line in build.setting to control which platforms include the plugin. You still need to add conditional code in you main.lua so you only require the proper plugin for the current platform:

The following platforms names are supported: iphone, android, [android-kindle], and [android-nook]. Note the bracket characters around android-kindle and android-nook.

You need to list all the platforms supported and leave out the ones not supported. Setting the platform to false does not work at this time. Leaving out the supportedPlatforms line will make the plugin available for all platforms (assuming that the plugin supports all platforms).

That’s it for today’s questions. I hope you’ve enjoyed them and even learned a few things.

Read more:

Wednesday FAQs: Using Corona Plugins