device detection ?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
d.m.holdawayGA2553
Posts: 81
Joined: Mon Jan 09, 2012 4:48 pm

device detection ?

Post by d.m.holdawayGA2553 » Tue May 15, 2012 11:55 am

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.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: device detection ?

Post by Klaus » Tue May 15, 2012 11:58 am

Hi d.m.holdawayGA2553,

check "environment", "platform" and "machine" in the dictionary.
"machine" might be what you are looking for.


Best

Klaus

d.m.holdawayGA2553
Posts: 81
Joined: Mon Jan 09, 2012 4:48 pm

Re: device detection ?

Post by d.m.holdawayGA2553 » Tue May 15, 2012 12:35 pm

i checked machine and it does not seem to cover mobile devices such as iphones and android based smart phones.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: device detection ?

Post by Klaus » Tue May 15, 2012 1:02 pm

d.m.holdawayGA2553 wrote:i checked machine and it does not seem to cover mobile devices such as iphones and android based smart phones.
Things ain't what they SEEM to be!
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 8)


Best

Klaus

d.m.holdawayGA2553
Posts: 81
Joined: Mon Jan 09, 2012 4:48 pm

Re: device detection ?

Post by d.m.holdawayGA2553 » Tue May 15, 2012 1:04 pm

well i looked at the online dictionary and it did not mention the devices.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: device detection ?

Post by Klaus » Tue May 15, 2012 1:25 pm

East, West, home is best! :)

d.m.holdawayGA2553
Posts: 81
Joined: Mon Jan 09, 2012 4:48 pm

Re: device detection ?

Post by d.m.holdawayGA2553 » Wed Aug 08, 2012 12:26 pm

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..

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: device detection ?

Post by sturgis » Wed Aug 08, 2012 2:30 pm

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.

Post Reply