Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Phone or Tablet?

Author
Message
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 3rd Jan 2017 18:05
How can I define is it phone or tablet, or just to know physical size of device screen in inches?
This needs to define the size of the UI and other visuals.
Thanks.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 3rd Jan 2017 22:52
Device
- Added GetDeviceDPI command for iOS and Android
- Added GetDevicePlatform command that re
AGK (Steam) V2.0.22 : Windows 10 Pro 64 Bit : AMD (16.12.1) Radeon R7 265 : Mac mini OS Sierra (10.12)
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 4th Jan 2017 07:52
You could use something like this to work out the width and height in inches:


V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 4th Jan 2017 18:29
GetDeviceDPI() does mean nothing. The android device can be with similar DPI on phone and on tablet...
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Jan 2017 19:40 Edited at: 4th Jan 2017 19:41
...
AGK (Steam) V2.0.22 : Windows 10 Pro 64 Bit : AMD (16.12.1) Radeon R7 265 : Mac mini OS Sierra (10.12)
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Jan 2017 19:40
maybe your phone have hd and your tablet full hd?

at my phone i have 327 dpi and at my tablet 213 dpi, both have hd.

currently i am unsure that dpi is what we are looking for.
AGK (Steam) V2.0.22 : Windows 10 Pro 64 Bit : AMD (16.12.1) Radeon R7 265 : Mac mini OS Sierra (10.12)
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 4th Jan 2017 20:41 Edited at: 4th Jan 2017 20:53
@Markus:
According to my maths (Which may be wrong, it's getting late and I'm half cooking dinner while I try and do this), but using the dpi figures you gave above, and assuming a resolution of 1920 x 1080, I have calculated that you have a 10" tablet (Which I can believe), and a 6.7" Mobile phone (Which is massive! I have a Note 3 and my screen is no where near as large)

>Edit<

I just ran the following code on my Note 3,



And it returned 5.7", which is exactly the size the internet says my phone is (I don't have a ruler to hand either, and can't run off to look for one for fear of burning the burgers)

>Edit 2<
Again, I just ran the same code on my iPhone 4s and it correctly reported the screen size as 3.5"
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Jan 2017 22:55
prof
at my tablet the result was wrong.
i calculated inch as centimetres and i have a ruler.
but i not calculated the dpi myself for a compare.
and i saw at pc we got zero dpi.
AGK (Steam) V2.0.22 : Windows 10 Pro 64 Bit : AMD (16.12.1) Radeon R7 265 : Mac mini OS Sierra (10.12)
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 5th Jan 2017 09:31
Quote: "GetDeviceDPI() does mean nothing."
DPI = Dots Per Inch, so:
(Device Width in Pixels) / (Dots Per Inch) = Width in Inches.
Yes, the DPI can be similar between mobile and tablet, but that just means you'll have more pixels on a bigger device, so this CAN be used to calculate the physical size of the device. It can also be used to detect orientation

Prof took it a step further by using pythagoras to calculate the diagonal corner to corner screen size Nice!

Quote: "and i saw at pc we got zero dpi."
This is expected, as per the docs: "This only works on iOS and Android, other platforms will reutrn 0".



V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Jan 2017 10:41
for my device its wrong, see photo.
product description: Lenovo IdeaTab A5500-F 20,3 cm (8 Zoll) Tablet-PC
AGK (Steam) V2.0.22 : Windows 10 Pro 64 Bit : AMD (16.12.1) Radeon R7 265 : Mac mini OS Sierra (10.12)

Attachments

Login to view attachments
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 5th Jan 2017 11:00 Edited at: 5th Jan 2017 11:02
@Markus
According to GSM Arena, your tablet has a resolution of 1280 x 800, not 1920 x 1080; This would make the size calculation Just over 7" which is a little closer to the mark.

@CJB:
I only added the Pythagoras but because screen size is measured from corner to corner
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Jan 2017 11:18
prof,
i think it should have ~ 188.8 dpi at 1280x800 , agk show 213 dpi.
AGK (Steam) V2.0.22 : Windows 10 Pro 64 Bit : AMD (16.12.1) Radeon R7 265 : Mac mini OS Sierra (10.12)
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 5th Jan 2017 12:25
http://specdevice.com/showspec.php?id=5d31-4dc2-c730-36b300000000

Shows 213 DPI.

There may be some confusion/discrepancy between PPI and DPI or simply erroneous data. The value AppGameKit pulls would be direct from Android's metrics API, though I haven't personally researched the total accuracy of that (these days many aspects of Android are just based on generic sizes--normal/large/xlarge etc.)

Login to post a reply

Server time is: 2024-09-29 21:25:55
Your offset time is: 2024-09-29 21:25:55