Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

List of exact device names?
Started by d.mach Aug 09 2014 12:14 AM

6 replies to this topic
device names device iphone iphone5 iphone6
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 846 posts
  • Corona SDK

I want to implement a check on which device the app is playing. Is it possible to get the information if it is an iPhone, an iPod or a new device like the iPhone5 or even iPhone6 or new iPods with different screen sizes than the older models?

How can I check via code on which of those devices the app is being started?

 

I want to implement some different code for the older models, because they are very slow regarding the new particle features of corona.

 

Thx for your help!



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,660 posts
  • Enterprise

For this, system.getInfo() is your friend.  See:

 

http://docs.coronalabs.com/api/library/system/getInfo.html

 

You can also determine a lot just from the various items presented by this call.

 

Rob



[TOPIC: post.html]
#3

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 846 posts
  • Corona SDK

Thx for the fast info Rob!

 

Is there some information about the correct names for an iPhone 4 and iPhone4s when using 'architectureInfo'? What about the names for iPods of the same category? There is this list for the older devices like:

  • "iPhone1,1" = iPhone 1G
  • "iPhone1,2" = iPhone 3G
  • "iPhone2,1" = iPhone 3GS
  • "iPod1,1" = iPod touch 1G
  • "iPod2,1" = iPod touch 2G

but there isn't more info about the newer ones or iPods.

 

Can these name change in the future or is it okay to check for this names in the code, like for example: if it is "iPhone4,1" (if this is the right name) then do XY?

 

Thx!

 

Daniela

 

PS: I don't have all the mentioned devices here, so I can not test it on actual hardware to get the right names!



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,660 posts
  • Enterprise

You should be able to use Google and search for iPod device names and look for a modern list that lists all devices.  I bet there is a wikipedia page for this.



[TOPIC: post.html]
#5

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 846 posts
  • Corona SDK

Thank you for pointing me in this direction! I somehow thought this is Corona related. I found some code snippet with this information...

 

if ([platform isEqualToString:@"iPhone1,1"]) return @"iPhone 2G";
if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";
if ([platform isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";
if ([platform isEqualToString:@"iPhone3,1"]) return @"iPhone 4";
if ([platform isEqualToString:@"iPhone3,2"]) return @"iPhone 4";
if ([platform isEqualToString:@"iPhone3,3"]) return @"iPhone 4 (CDMA)";
if ([platform isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
if ([platform isEqualToString:@"iPhone5,1"]) return @"iPhone 5";
if ([platform isEqualToString:@"iPhone5,2"]) return @"iPhone 5 (GSM+CDMA)";
if ([platform isEqualToString:@"iPhone5,3"]) return @"iPhone 5c (GSM+CDMA)";
if ([platform isEqualToString:@"iPhone5,4"]) return @"iPhone 5c (UK+Europe+Asis+China)";
if ([platform isEqualToString:@"iPhone6,1"]) return @"iPhone 5s (GSM+CDMA)";
if ([platform isEqualToString:@"iPhone6,2"]) return @"iPhone 5s (UK+Europe+Asis+China)";

if ([platform isEqualToString:@"iPod1,1"]) return @"iPod Touch (1 Gen)";
if ([platform isEqualToString:@"iPod2,1"]) return @"iPod Touch (2 Gen)";
if ([platform isEqualToString:@"iPod3,1"]) return @"iPod Touch (3 Gen)";
if ([platform isEqualToString:@"iPod4,1"]) return @"iPod Touch (4 Gen)";
if ([platform isEqualToString:@"iPod5,1"]) return @"iPod Touch (5 Gen)";

if ([platform isEqualToString:@"iPad1,1"]) return @"iPad";
if ([platform isEqualToString:@"iPad1,2"]) return @"iPad 3G";
if ([platform isEqualToString:@"iPad2,1"]) return @"iPad 2 (WiFi)";
if ([platform isEqualToString:@"iPad2,2"]) return @"iPad 2";
if ([platform isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)";
if ([platform isEqualToString:@"iPad2,4"]) return @"iPad 2";
if ([platform isEqualToString:@"iPad2,5"]) return @"iPad Mini (WiFi)";
if ([platform isEqualToString:@"iPad2,6"]) return @"iPad Mini";
if ([platform isEqualToString:@"iPad2,7"]) return @"iPad Mini (GSM+CDMA)";
if ([platform isEqualToString:@"iPad3,1"]) return @"iPad 3 (WiFi)";
if ([platform isEqualToString:@"iPad3,2"]) return @"iPad 3 (GSM+CDMA)";
if ([platform isEqualToString:@"iPad3,3"]) return @"iPad 3";
if ([platform isEqualToString:@"iPad3,4"]) return @"iPad 4 (WiFi)";
if ([platform isEqualToString:@"iPad3,5"]) return @"iPad 4";
if ([platform isEqualToString:@"iPad3,6"]) return @"iPad 4 (GSM+CDMA)";
if ([platform isEqualToString:@"iPad4,1"]) return @"iPad Air (WiFi)";
if ([platform isEqualToString:@"iPad4,2"]) return @"iPad Air (GSM+CDMA)";
if ([platform isEqualToString:@"iPad4,4"]) return @"iPad Mini Retina (WiFi)";
if ([platform isEqualToString:@"iPad4,5"]) return @"iPad Mini Retina (GSM+CDMA)";

if ([platform isEqualToString:@"i386"]) return @"Simulator";
if ([platform isEqualToString:@"x86_64"]) return @"Simulator";


[TOPIC: post.html]
#6

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,660 posts
  • Enterprise

Just keep in mind as Apple comes out with new devices, they will have different values.  We can't predict what the iPhone 6 will be, in particular with new models.  I



[TOPIC: post.html]
#7

lano78

[GLOBAL: userInfoPane.html]
lano78
  • Contributor

  • 370 posts
  • Corona SDK

local devices = {
    -- iPhone
    ["iPhone1,1"] = "iPhone 2G",
    ["iPhone1,2"] = "iPhone 3G",
    ["iPhone2,1"] = "iPhone 3GS",
    ["iPhone3,1"] = "iPhone 4",
    ["iPhone3,2"] = "iPhone 4",
    ["iPhone3,3"] = "iPhone 4 (CDMA)",
    ["iPhone4,1"] = "iPhone 4S",
    ["iPhone5,1"] = "iPhone 5",
    ["iPhone5,2"] = "iPhone 5 (GSM+CDMA)",
    ["iPhone5,3"] = "iPhone 5c (GSM+CDMA)",
    ["iPhone5,4"] = "iPhone 5c (UK+Europe+Asis+China)",
    ["iPhone6,1"] = "iPhone 5s (GSM+CDMA)",
    ["iPhone6,2"] = "iPhone 5s (UK+Europe+Asis+China)",
    -- iPod
    ["iPod1,1"] = "iPod Touch (1 Gen)",
    ["iPod2,1"] = "iPod Touch (2 Gen)",
    ["iPod3,1"] = "iPod Touch (3 Gen)",
    ["iPod4,1"] = "iPod Touch (4 Gen)",
    ["iPod5,1"] = "iPod Touch (5 Gen)",
    -- iPad
    ["iPad1,1"] = "iPad",
    ["iPad1,2"] = "iPad 3G",
    ["iPad2,1"] = "iPad 2 (WiFi)",
    ["iPad2,2"] = "iPad 2",
    ["iPad2,3"] = "iPad 2 (CDMA)",
    ["iPad2,4"] = "iPad 2",
    ["iPad2,5"] = "iPad Mini (WiFi)",
    ["iPad2,6"] = "iPad Mini",
    ["iPad2,7"] = "iPad Mini (GSM+CDMA)",
    ["iPad3,1"] = "iPad 3 (WiFi)",
    ["iPad3,2"] = "iPad 3 (GSM+CDMA)",
    ["iPad3,3"] = "iPad 3",
    ["iPad3,4"] = "iPad 4 (WiFi)",
    ["iPad3,5"] = "iPad 4",
    ["iPad3,6"] = "iPad 4 (GSM+CDMA)",
    ["iPad4,1"] = "iPad Air (WiFi)",
    ["iPad4,2"] = "iPad Air (GSM+CDMA)",
    ["iPad4,4"] = "iPad Mini Retina (WiFi)",
    ["iPad4,5"] = "iPad Mini Retina (GSM+CDMA)",
    -- Simulator
    ["i386"]   = "Simulator",
    ["x86_64"] = "Simulator",
    ["ppc"]    = "Simulator",
    ["ppc64"]  = "Simulator"
}

local Model = devices[system.getInfo("architectureInfo")]

print(" Model : "..Model)

If anyone have a list of android devices feel free to add them and share.




[topic_controls]
[/topic_controls]