Returns information about the system on which the application is running.
1 | system.getInfo( parm ) |
print( system.getInfo( "deviceID" ) ) -- display the deviceID
parm
The first argument param is a string that determines what is returned.
Valid values for param:
"name" returns the human readable model name. On iPhone, this would be the name of the phone as it appears in iTunes, e.g. "Steve's iPhone".
"model" returns the device model (as specified by the manufacturer). These include:
Note: The above is a list of all the iOS models and the Android devices used in the Corona Simulator. Most Android devices return a model number instead of a model name.
"deviceID" returns the unique id of the device, e.g. IMEI or similar number.
"environment" returns the environment that the app is running in. These include:
"platformName" returns the platform name (the OS name), i.e. one of the following:
"platformVersion" returns a string representation of the platform version. This is sometimes, but not always, a number -- for example a Droid X is currently returning "2.1-update1".
"version" This is deprecated. Use "build" instead to distinguish between different Corona build versions.
"build" returns the Corona build string as it appears in the About box of the Corona Simulator.
"textureMemoryUsed" returns the texture memory usage (in bytes). Texture memory (for graphics/images) tends to be the most sharply limited resource in mobile development, since it runs out before normal memory.
"maxTextureSize" returns the maximum texture width or height supported by the device. (Available starting from Build 2011.310)
"architectureInfo" returns a string describing the underlying CPU architecture of the device you are running on. This API is mostly for internal debugging but may have uses. Strings may be subject to changes in the future depending on the changing landscape of devices and CPUs. (Available starting from Build 2011.326).
Android on ARM devices will return "ARM" (typically for ARMv6) or "ARM Neon" (ARMv7). iOS will return values such as: "iPhone1,1", "iPhone1,2", where mappings are:
Mac may return i386, x86_64, ppc, or ppc64. (Currently only i386 is available.)
Windows is currently unsupported.
String of parameter requested.
"maxTextureSize" available in Build 2011.310
"architectureInfo" available in Build 2011.326
iPad = iOS = "iPhone OS"
Hopefully the documentation is clearer now.
"architectureInfo" is going to help me big-time. A big thank you!
actually, when running on iPod touch the parameter "model" returns "iPod touch".
remember that when you're setting up your isiPhone-trigger:
1 2 3 4 5 6 7 8 9 | -- check device isIPhone = false if(system.getInfo("model") == "iPhone") or (system.getInfo("model") == "iPod touch") then isIPhone = true end if isIPhone == true then print("iPhone or iPod touch, yaay!") end |
Finefin - great code! Thanks
>>"deviceID" returns the unique id of the device, e.g. IMEI or similar number.
so the little android tells me :
357342043390887
which is the IMEI
but all the ios devices tell me something like:
c35b8a34b69b972806d57fb2f0c2228c938c069a
okay now. what is that? i mean it looks like a hash to me...
so what does "or simmilar" exactly mean?
It means what ever the device manufacturer wants it to mean. We just report the deviceID returned by the device.
Which string it will return for the Amazon Fire?
Amazon Fire returns "Amazon Fire" for model.
Is it possible for us to get this information?
Country Code
Language Code
Carrier Name
Carrier ISO country code
Carrier Mobile Country Code
Carrier Mobile Network
This would be really helpful if we could have this for internal analytic.
All the other stuff is helpful but I really would like more.
What information would a NOOK return for "model"? Thx.
How can we distinguish between iPhones with retina display and older phones without it? I want to load a movieclip with high-def graphics for the retina displays, but I don't see a way to check it the device has retina.
@finefin - Thank You!
Your post was the unique place I found some info about what the API "model" returns when it`s an iPod (that returns "iPod touch").
Happy 2012!
Cheers,
Rodrigo.
you can use this to get informations about "older" and newer retina devices.
1 2 3 4 5 6 7 | Device.getSuffix = function() if system.getInfo('maxTextureSize') > 1024 then return "@2x"; else return ""; end; end; |
@treitel, not all devices > 1024 maxTextureSize are Retina devices. The iPhone 3G and iPad return 2048 and they don't have retina displays. The iPhone 3 returned 1024.
How can I get the device name (UUID) on iphones/ipads? It's the first entry of Settings\General\Information.
what this function will return for "platformName" if it is amazon kindlefire and for Nook??
I too would like to know what the platformName for Nook is, Tom above he said that kindle fire is "Amazon Fire"
Hi! How do know if I'm in any TABLET?
platformName for the Nook is "Android." I've seen the following model names returned for Nook:
BNTV250 for Nook Tablet
BNTV200 for Nook Color
Be aware that the manufacturer creates the model string and subject to change.
There is no full-proof way to tell if the device is a tablet or not. You can do a check of the model names and look at the display.width and display.height along with the scale factor, to make a guess about the device type.
I think this is actually incorrect - just took possession of our Kindle Fire test device and system.getInfo("model") returns "Kindle Fire"
How can we tell if the device is a new iPad (retina)? And should the simulator return special values to help us determine this? In the newest build (2012.772) it returns 2048 for texture memory even when we're on the iPad Retina (is that correct)?
@DavidBFox,
The iPad Retina simulator returns "iPad" because that is what the real device returns. Historically, Apple doesn't want you to know what device you're running on so it doesn't make this information easy to get. You can tell if you are on certain device by either looking at the display.contentWidth and display.contentHeigh (if dynamic scaling is off) or the display.contentScaleX and display.contentScaleY.
The simulator does not simulate the texture memory size used by the device. It returns the value for the device you're simulating on.
Thanks Tom! I found the display.contentScaleX/Y worked well. But even better, after switching from the older display.newRetinaText() to the new display.newText() actually fixed my problem, so I didn't need to know which iPad it was running on.
Now that UDID is deprecated in iOS5, what will "deviceID" return? Will it still be a unique ID per device?
Thx!
i'd also like to know the UDID question on iOS since deprecation. has it been changed yet in Corona since the new apple requirement?
I don't have an iPad, would the platformName return as "iPad" or "iPhone OS" ?