Reputation: 2500
I created app which work very good on tablet and phones. For detect (Settings for interface) im used width and heigh.. if width > 1280
- it's must be tablet.. But.. my friend tested this app on samsung galaxy note.. This is a small phone (NOT TABLET)BUT screeen resolution there = 1280x800. And now i have problem with displaying there.. Can any tell me - is there a way to detect: tablet or phone ??
Please tell me if anyone know..
Regards Peter.
p.s sorry for my bad english.. i trying be better.
Upvotes: 1
Views: 3565
Reputation: 2126
You can try this code, found in Chrome to Phone extension example:
static boolean isTablet (Context context) {
// TODO: This hacky stuff goes away when we allow users to target devices
int xlargeBit = 4; // Configuration.SCREENLAYOUT_SIZE_XLARGE; // upgrade to HC SDK to get this
Configuration config = context.getResources().getConfiguration();
return (config.screenLayout & xlargeBit) == xlargeBit;
}
Upvotes: 1
Reputation: 8402
For a phone to be a phone, it must be able to make calls. Why don't you check the TelephonyManager There is a method called getPhoneType(). If it returns PHONE_TYPE_NONE, then it is not a phone.
Upvotes: 0
Reputation: 3878
There is an example for designing for multiple screen see if it helps. Multiple screen designing
Upvotes: 0
Reputation: 6983
You can use something like Device Atlas to detect these features off the User Agent. The offer an API that you can host yourself, and they also offer a cloud service. Both are premium (paid-for)
Alternatively you can use something like Wurfl which, in my experience, is less accurate.
Upvotes: 0
Reputation: 4705
Width (or height) in pixel determine not the screen size. The screen size depends on the resolution (pixels) and the density. Android provides various concepts to support different screen sizes. See here for details: http://developer.android.com/guide/practices/screens_support.html
Upvotes: 0