device detection ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 81
- Joined: Mon Jan 09, 2012 4:48 pm
device detection ?
hello,
does anyone have or know of a device detection script example that i can look at
i want to be able to detect the different devices then load the correct graphics depending on which device it is.
any advice or examples are welcome.
does anyone have or know of a device detection script example that i can look at
i want to be able to detect the different devices then load the correct graphics depending on which device it is.
any advice or examples are welcome.
Re: device detection ?
Hi d.m.holdawayGA2553,
check "environment", "platform" and "machine" in the dictionary.
"machine" might be what you are looking for.
Best
Klaus
check "environment", "platform" and "machine" in the dictionary.
"machine" might be what you are looking for.
Best
Klaus
-
- Posts: 81
- Joined: Mon Jan 09, 2012 4:48 pm
Re: device detection ?
i checked machine and it does not seem to cover mobile devices such as iphones and android based smart phones.
Re: device detection ?
Things ain't what they SEEM to be!d.m.holdawayGA2553 wrote:i checked machine and it does not seem to cover mobile devices such as iphones and android based smart phones.
From the dictionary:
.....................................................
Value:
The machine function returns a string.
* x86 - windows based system
* iPod Touch - the device is one of the iPod Touch models
* iPhone - the device is one of the iPhone models
* iPhone Simulator - the device is a simulated iPhone
* iPad - the device is the iPad
* iPad Simulator - the device is a simulator iPad
Comments:
On Mac OS systems, the machine function uses the Gestalt() system call to determine the machine type.
On Unix systems, the machine function uses the uname() system function.
On Android devices, the machine function returns the manufacturer's name for the device. For example, if running on a Google Nexus One, the string is "Nexus One".
........................................................
BOLD formatting by me.
This info SEEMS (sic!) sufficient to me

Best
Klaus
-
- Posts: 81
- Joined: Mon Jan 09, 2012 4:48 pm
Re: device detection ?
well i looked at the online dictionary and it did not mention the devices.
Re: device detection ?
East, West, home is best! 

-
- Posts: 81
- Joined: Mon Jan 09, 2012 4:48 pm
Re: device detection ?
so i could use this to get my app to work on different devices then?
example..
so i would load the device id into a twhatdevice
if twhatdevice = "iphone" go card "iphonemain"
etc etc
so i might need to build about 40 different cards to cover the amount of different android devices..
example..
so i would load the device id into a twhatdevice
if twhatdevice = "iphone" go card "iphonemain"
etc etc
so i might need to build about 40 different cards to cover the amount of different android devices..
Re: device detection ?
Ok, for the iphone you might want to look at
iphoneDeviceScale() -- will let you know if you are on retina or not
iphoneUseDeviceResolution()
iphoneDeviceResolution()
This way you can determine if the device has a retina display, then you can either work with logical points or pixels depending on the setting of iphoneUseDeviceResolution
For android I suggest looking at the screenrect. You can then use this information to determine how you want to put together your screens.
iphoneDeviceScale() -- will let you know if you are on retina or not
iphoneUseDeviceResolution()
iphoneDeviceResolution()
This way you can determine if the device has a retina display, then you can either work with logical points or pixels depending on the setting of iphoneUseDeviceResolution
For android I suggest looking at the screenrect. You can then use this information to determine how you want to put together your screens.