With this code, you can determine whether the device is a smartphone or tablet.
I have tablet with a resolution of 800x480, but is not recognized as a tablet, Why?
B4X:
Sub GetDevicePhysicalSize As Float
Dim lv As LayoutValues
lv = GetDeviceLayoutValues
Return Sqrt(Power(lv.Height / lv.Scale / 160, 2) + Power(lv.Width / lv.Scale / 160, 2))
End Sub
Sub IsTablet As Boolean
If GetDevicePhysicalSize > 6 Then
'7'' or 10'' tablet
Return True
Else
'phone
Return False
End If
End Sub
There are just a few tablets with telephony capabilities, if you need to determine if the device is a phone or tablet you will have to combine your queries, check for "small" screen, then "large" screen WITHOUT telephony and then "large" screen WITH telephony, note that you might get some false positives, especially from "clone" tablets.
How do you do that: "...large" screen WITHOUT telephony and then "large" screen WITH telephony... ??
Using screen sizes is not good practice, considering that 7 inch tablets with phone capabilities are now coming to market!
A tablet is anything bigger than 6 inches. (And "phablets" are blurring that line)
I have 2, 7 inch tablets with a "permanent" data connection (Galaxy Tab and Nexus 7)
If you're using this simply to detect if there is a data connection or not, you're going about it the wrong way.