Skip to content Skip to sidebar Skip to footer

Android - How To Find Out From Within Running App If Device It Is Running On Is Phone Or Tablet

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.

Solution 1:

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!

Post a Comment for "Android - How To Find Out From Within Running App If Device It Is Running On Is Phone Or Tablet"