Is there a method to identify if the device the app is running on is a phone or a tablet? We want to implement different behavior depending of the device type.
1 Answers
If you want the differnce because of screensize, you should find screensize, but this is not really easy, as there are tablets with small screens and phones with large screens. Still, it is ofcourse possible to get screen size.
You could try to do do something with GSM capabilities. But again, there are exceptions, like tablets that can call..
I would advise against making this differentiation, and define it on the basis that you need. Screensize, capabilities etc. You might get groups that consist of both "phones" and "tables", but you'll have a much better knowledge of what your group is like.
I'm still not sure how to define a "tablet" and everything you try needs that definition, but if you take a look at this link, you can see that it might be (did a quick read) that things that consider themselves tablets do not identify themselves in a user-agent string as a mobile device. But:
- you would need to get the useragent string for the devices' browser. Which would be illogical to use i guess
- Useragent strings can be changed, like some people don't want mobile sites, so they change their agent string. That would influence your behaviour, which is weird.
In the end I think you need to define what a tablet is, and then check for that!

- 64,065
- 16
- 119
- 163
-
exactly - the galaxy tab can accept a SIM card in europe – dave.c Feb 09 '11 at 16:58
-
Thanks Nanne, what I need to do is to send from my app back to external API either 'Phone' or 'Tablet' label. This has nothing to do with capabilities of device, I do know how to identify these. – remizolya Mar 31 '11 at 12:07
-
But why? What is the difference between the two that you are looking for in your external API. You have to define what a tablet or a phone _is_ before you can actually try and find it in code. So is everything that can have simcard a phone? Or is it screensize related? How would you define what a tablet is, that is the main question I guess. I'll add a small trick later that might help – Nanne Mar 31 '11 at 13:07