Flashy Substance Blog

Tips and Tricks in Cross Platform Mobile Development

supportedPlatforms
0

A comprehensive explanation of supportedPlatforms in Corona SDK’s build.settings file

SupportedPlatforms was introduced a long time ago in item 5 of the Wednesday FAQ’s in a Corona blog post.  Corona’s official documentation for the build.settings file shows this table, but it’s not completely clear how it works or what values are available  It’s important that you understand exactly how to use it or you may get confused and include or exclude the wrong plugins at the wrong time.

The supportedPlatforms key is used inside of a given plugin’s table.  It instructs Corona whether or not to include a given plugin when building for a particular target store (as selected during the build process).

Three key ideas can greatly assist your understanding of this value:

  • The inclusion is based upon what store target you select during the build process, not the end user’s device.  Why does this matter?  Consider the following examples:

    • Barnes and Noble NOOK devices have the Google Play store installed.  If you target android-nook with a plugin but not android, they will only get the plugin in the build if they install it from the NOOK app store.
        
    • The Amazon App store is available for download from Amazon on a wide variety of devices that Amazon does not make.  If a Samsung Galaxy S3 owner happens to have the Amazon App Store installed, and they download your app from the AMAZON app store rather than Google Play, the inclusion of the plugin will be based on whether or not android-kindle is included.
  • If the supportedPlatforms table is completely left out for a plugin, it will be included on EVERY store target, including iOS and every Android store. 
  • If you DO include a supportedPlatforms entry, ONLY the included platforms will include the plugin upon build. 
  • Setting the value to false doesn’t work

POSSIBLE VALUES

Here’s a list of all possible values for the supportedPlatforms table.   Note that platforms with a dash need to be wrapped in quotes AND brackets.  This list comes from seanh (Corona staff) in the Corona thread at http://forums.coronalabs.com/topic/38855-plugins-hell/

  • iphone —whenever you build for iOS and pick ‘device’, whether it’s universal or iPad/iPhone only, this is the relevant value
  • [“iphone-sim“] —xCode simulator
  • [“android-nook“] —Nook app store
  • [“android-kindle“] — Amazon App Store
  • Android —all other android app stores, including Google Play, Ouya, and GameStick

EXAMPLES

Flurry is an example of a plugin that you may want to include on every single platform.  In that case, do not include the supportedPlatforms key at all.

["CoronaProvider.analytics.flurry"] = {
   publisherId = "com.coronalabs",
}

Amazon’s iAP plugin should only be used in the Amazon app store, so let’s include supportedPlatforms and only make it work when the store target is amazon.

["plugin.amazon.iap"] = {
   publisherId = "com.amazon",
   supportedPlatforms = { ["android-kindle"]=true },
}

Apple Game Center is a plugin as of Corona Build #2455, and it only works on iOS devices, so let’s only include  it on iOS device and xCode simulator builds.

[“CoronaProvider.gameNetwork.apple”] = {
   publisherId = “com.coronalabs”,
   supportedPlatforms = { iphone=true, [“iphone-sim”]=true },
}
Corona SDK

Joe • November 27, 2014


Previous Post

Next Post

Leave a Reply

Your email address will not be published / Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>