Type | Library |
Corona Store | device |
Keywords | device, dpi, support |
See also | Sample code |
The device plugin can be used in your Corona project. It enables you to easily get information about the device running the application in one place, including what events are supported.
With access to xdpi and ydpi information for the device it is also possible to create an application with fixed real size display objects (i.e. the same size on multiple device screens), or to run the application with a stretched display without stretching display objects (see xdpi/ydpi for more information).
local device = require "plugin.device"
In order to use this plugin, you must activate the plugin at the Corona Store.
When you build using the Corona Simulator, the server automatically takes care of integrating the plugin into your project.
All you need to do is add an entry into a plugins
table of your build.settings
. The following is an example of a minimal build.settings
file:
settings =
{
plugins =
{
-- key is the name passed to Lua's 'require()'
["plugin.device"] =
{
-- required
publisherId = "com.pelagic-games",
},
},
}
If you have activated this plugin, you can download this plugin from the corresponding plugin page in the Corona Store.
Not supported with Corona Cards, as the device information will not be directly accessible to the library.
Some properties are only supported on Android and iOS, but may work on other platforms. In particular, xdpi and ydpi are only expected to work on Android and iOS.
You can access sample code here.
More support is available from the Pelagic Games team:
Platform | Supported |
---|---|
iOS | Yes |
Android | Yes |
Android (GameStick) | Yes |
Android (Kindle) | Yes |
Android (NOOK) | Yes |
Android (Ouya) | Yes |
Mac App | Partial |
Win32 App | Partial |
Windows Phone 8 | Partial |
Corona Simulator (Mac) | Partial |
Corona Simulator (Win) | Partial |