Know the device where is running my app

Getting into LiveCode for iOS? Ask your questions here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Know the device where is running my app

Post by aebki » Fri Feb 13, 2015 7:59 pm

Hi,

I would like to know in which device is running my app, i looked on the lessons but i didn't manage to find it, and also in the dictionary...:-(

Is is possible to know to know if it is running in one iPhone, iPad (or also android phone or android tablet) ?

What i could see is the environment ( 'mobile', 'browser', etc...), but not know the device...:-(

In fact my first target was to install the app, i made, also in one iPhone, but i had one error...And as i can't test (for the moment) , for example, in which place is appearing the keyboard ( so, which fields is hiding the keyboard in my card ) i thought that maybe it will be different depending on the devices. And for this, my reason to know in which device is running my app...

Or everything is 'easier' than what i am thinking? So, if in my iPad the keyboard is hiding the fields 6 to 10 ( in landscape) , it will be the same for the iPhone.

I hope i expressed myself well...:-)

Regards

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5116
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Know the device where is running my app

Post by jacque » Sat Feb 14, 2015 10:21 pm

See "machine" in the dictionary.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Know the device where is running my app

Post by aebki » Sun Feb 15, 2015 6:09 pm

Hi Jacque,

Thanks for your answer...:-)

I saw in the dictionary and it is written this:
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".
So for iPhone and iPad it will work, but it means that there is no way to know if it is running on one android phone or android tablet?
I was looking for one list of manufacturer's name for the android devices and for the moment i didn't find...But even if there is one list now of devices, it means that i have to update the list each time one new device is appearing to can control if it is running on phone or tablet? :-(
It is a pity that this function is not returning one string like for iOS ( so 'iPhone' or 'iPad')...:-(

so, if it is like this, i will come back to my second question of my first post...:-)

Or everything is 'easier' than what i am thinking? So, if in my iPad the keyboard is hiding the fields 6 to 10 ( in landscape) , it will be the same for the iPhone???
and of course the same for android?

Regards.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5116
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Know the device where is running my app

Post by jacque » Sun Feb 15, 2015 6:42 pm

It isn't practical to branch the code for every possible device, as you said. Instead you should look at the "effective working screenrect" which will give you the dimensions of the available screen space when the keyboard is showing. The last item in that rect will be the top of the keyboard, and you can determine which fields will be covered from that number.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: Know the device where is running my app

Post by aebki » Sun Feb 15, 2015 11:08 pm

Hi Jacque,

Thanks for your answer and your advice! :-)

Ok, so i will try to do what you told me! :-)

Regards.

Post Reply

Return to “iOS Deployment”