Differentiate between Mobile and Tablet

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Googie85
Posts: 199
Joined: Tue Aug 05, 2014 10:07 am

Differentiate between Mobile and Tablet

Post by Googie85 » Tue May 22, 2018 6:25 am

Hi Guys!

I am trying to find out the device type of an Android device.

Any Ideas?

Many Thanks,

Googie.

mrcoollion
Posts: 719
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Differentiate between Mobile and Tablet

Post by mrcoollion » Fri Jun 01, 2018 7:05 pm

Hello Googie,

In essence a mobile and a tablet are the same device type except for the size and the fact that you cannot use a tablet as a phone (with some tablets you can).

You could try to get the the platform and the version of the platform and you might see a difference but if the OS and OS version is the same I do not think you will see any difference.

How? See http://lessons.livecode.com/m/2592/l/12 ... em-version

Maybe anybody else has a great idea?

Regards,

Paul

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Differentiate between Mobile and Tablet

Post by trevix » Tue Nov 19, 2019 7:48 pm

Since machine() on android does not clarify
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".
To find if an app is going to run on a phone or a tablet, can the "Screenrect" be of any help?
What are good screenrect values to distinguish the two?
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Differentiate between Mobile and Tablet

Post by FourthWorld » Tue Nov 19, 2019 8:28 pm

Googie85 wrote:
Tue May 22, 2018 6:25 am
I am trying to find out the device type of an Android device.
For what purpose? Screen size for layout? Connectivity options? Something else?

Once we understand your goal we can provide good guidance.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Differentiate between Mobile and Tablet

Post by [-hh] » Wed Nov 20, 2019 10:18 am

As trevix said. Isn't it the screenRect you wish to have at the very end?
Or computed from that the diagonal = sqrt(width*width+height*height), may be converted to inches?

[Edit: Corrected "screenSize" to "screenRect".]
Last edited by [-hh] on Wed Nov 20, 2019 4:15 pm, edited 1 time in total.
shiftLock happens

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Differentiate between Mobile and Tablet

Post by trevix » Wed Nov 20, 2019 10:52 am

Sorry if I wasn't clear.
I am talking of screen size.
Since I want to share my code between the 2 UI (phone and tablet), I nee to shrink my control position up to 1/3 for the phone.
And probably reposition controls...Actually, create a card for tablet and a card for phone.

- How do I determine, on Android, if is a tablet or a phone, considering that I cannot develop for any possible combination of screen size?

- I there a Android screen size that I can consider a point of separation of tablets from phones? Like 4 inches?

- Is there other ways to accomplish this thing?

Sorry for not explaining the all thing better. The different language doesn't help but, most important, I often feel like I am asking for things that should concern any LC developer that want to create an application and I am amazed that nobody took already care of it.
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Differentiate between Mobile and Tablet

Post by [-hh] » Wed Nov 20, 2019 4:34 pm

trevix wrote:I often feel like I am asking for things that should concern any LC developer that want to create an application and I am amazed that nobody took already care of it.
The question is why none of the professional LC-Android developers answered here...
I'm not, so see my answer as "elementary":

From the screenRect you have the width and height.
Then, as I wrote above, diagonal=sqrt(width*width+height*height).
Now, what you call "screen size" is diagonal/dpi.

The dpi (dots per inch) is usually 72. But there are also higher resolutions.
For iOS you can get that with a LC function. For Android I only know a JavaScript way.

Currently (and this is changing in medium time intervals) diagonal/72 = 6.5 inches,
or diagonal = 468 (=6.5*72) may be a a good "point of separation".
Larger is your imaginary "Tablet", not larger is your imaginary "Mobile".
shiftLock happens

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

Re: Differentiate between Mobile and Tablet

Post by jacque » Wed Nov 20, 2019 6:00 pm

in general it doesn't matter if the device is a tablet or a phone because there is no definitive dividing line between the two on Android. There are phones that are as large as small tablets ("phablets") so what you get is a continuum where the definition of a tablet is an arbitrary point. If you absolutely want to define the two separately then I'd say 8 inches is probably the best point to use. There are almost no 7 inch tablets made any more though your users may still have one. Some new phones go up to 6.7 inches so the difference is trivial.

Resolution (actually called "density") varies all over the map, from screen density 120 to 640 dpi You'd need to account for that if you want to calculate inches.

Instead, I think most of us either use one of the fullscreen modes, or if you want to do it manually, the effective working screenrect to calculate where control placement should go. It doesn't matter what the definition of the device is, only what available space you have to work with. LiveCode will calculate the screen coordinates for you, accounting automatically for density, when you specify normal card coordinates.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Differentiate between Mobile and Tablet

Post by FourthWorld » Wed Nov 20, 2019 6:37 pm

trevix wrote:
Wed Nov 20, 2019 10:52 am
I am talking of screen size.
Thanks. And good news: you're in good company, since every developer for mobile devices, whether making native apps or web apps, faces the same challenge, and most use the same approach for meeting that challenge, "responsive design":

viewtopic.php?f=7&t=30609#p163867
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Differentiate between Mobile and Tablet

Post by trevix » Wed Nov 20, 2019 10:41 pm

May be the divider is the finger size, since anyUI button smaller then, say, 5mm is going to be very tough to press.
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

Post Reply

Return to “Android Deployment”