Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
getDeviceInfo returned values? — Gideros Forum

getDeviceInfo returned values?

nat12nat12 Member
edited August 2012 in General questions
Hello,

the documentation of application:getDeviceInfo say
> For iOS, returns 5 values: “iOS”, iOS version, device type, user interface idiom and device model

which possible values are returned for device type?
(i am interested into distinguish iPads from other iOS devices)

Comments

  • Check the resolution
    local o = application:getOrientation()
     
    if (o == Application.LANDSCAPE_LEFT) or (o == Application.LANDSCAPE_RIGHT) then
    	DWIDTH = application:getDeviceHeight()
    	DHEIGHT = application:getDeviceWidth()
    else
    	DWIDTH = application:getDeviceWidth()
    	DHEIGHT = application:getDeviceHeight()
    end
     
    WIDTH = application:getContentWidth()
    HEIGHT = application:getContentHeight()

    if application:getDeviceWidth() == 768 then it's an iPad
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • atilimatilim Maintainer
    Accepted Answer
    @techdojo if you enable retina display for iPad 3, application:getDeviceWidth() will return 768 * 2, and you'll cry a lot :)

    1st value -> "iOS"
    2nd value -> [[UIDevice currentDevice] systemVersion]
    3rd value -> [[UIDevice currentDevice] model]
    4th value -> UI_USER_INTERFACE_IDIOM() (as "iPhone" or "iPad")
    5th value -> hw.machine. Here are the possibilities:
    iPhone1,1 -> iPhone 1G, M68
    iPhone1,2 -> iPhone 3G, N82
    iPhone2,1 -> iPhone 3GS, N88
    iPhone3,1 -> iPhone 4/AT&T, N89
    iPhone3,2 -> iPhone 4/Other Carrier?, ??
    iPhone3,3 -> iPhone 4/Verizon, TBD
    iPhone4,1 -> (iPhone 4S/GSM), TBD
    iPhone4,2 -> (iPhone 4S/CDMA), TBD
    iPhone4,3 -> (iPhone 4S/???)
    iPhone5,1 -> iPhone Next Gen, TBD
    iPhone5,1 -> iPhone Next Gen, TBD
    iPhone5,1 -> iPhone Next Gen, TBD
     
    iPod1,1 -> iPod touch 1G, N45
    iPod2,1 -> iPod touch 2G, N72
    iPod2,2 -> Unknown, ??
    iPod3,1 -> iPod touch 3G, N18
    iPod4,1 -> iPod touch 4G, N80
     
    iPad1,1 -> iPad 1G, WiFi and 3G, K48
    iPad2,1 -> iPad 2G, WiFi, K93
    iPad2,2 -> iPad 2G, GSM 3G, K94
    iPad2,3 -> iPad 2G, CDMA 3G, K95
    iPad3,1 -> (iPad 3G, WiFi)
    iPad3,2 -> (iPad 3G, GSM)
    iPad3,3 -> (iPad 3G, CDMA)
    iPad4,1 -> (iPad 4G, WiFi)
    iPad4,2 -> (iPad 4G, GSM)
    iPad4,3 -> (iPad 4G, CDMA)
     
    i386, x86_64 -> iPhone Simulator
    Also you can look UIDevice documentation http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIDevice_Class/Reference/UIDevice.html for more detailed explanation of systemVersion and model properties.
  • @Atilim - I haven't cried since I got my new iPad :) but I'll bet @GregBUG did :))
    Fair point though - still the concept was sound :)
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • sorry to revive the old post but I wanted to confirm. If I want to check if this is an iPAD, should I use 3rd value or 4th one? My Ipad 3 returns iPad for both of them and I wanted to see which one is more reliable.

    Looks like the the 4th one?
  • @boriskey 3rd value is a model, which should have returned different values on ios, but for some reason [[UIDevice currentDevice] model] on ios returns ipad for both ipad 3 and 4

    and 4th value is idiom, to distinguish between ipad or iphone. So any ipad will be ipad and any iphone will be iphone :)

    http://docs.giderosmobile.com/reference/gideros/Application/getDeviceInfo#Application:getDeviceInfo
  • very clear now, thank you!
Sign In or Register to comment.