Distinguish between Tablet and Smart phone on ICS

2019-03-27 13:58发布

问题:

I understand that by default (pre ICS), to distinguish between a Tablet & Smartphone, a developer can use the sdk version in the Android Manifest (apart from screen size and openGL filters). Now with ICS running on both SP and Tablet, what options does a developer have in case I need to distinguish between SP and Tablet?

I don't think screen size is reliable.

Lets say for certain reasons I cannot have a common apk for SP and Tablet. I would also like to avoid a separate application for Tablets and SP

回答1:

The only significant differences between tablets and phones are, in general, screen size and the presence of telephony capabilities, plus the fact that phones will generally have mobile data while tablets may be wifi-only. With ICS, the software running on the two classes of device is basically the same, so the only interesting distinguishing features are these points. If a device has a screen big enough for your app and provides all the required capabilities, does it matter if it's a phone or a tablet?

I'd say that screen size is exactly what you should be filtering on. It's not 'phone version' and 'tablet version' so much as 'little screen' and 'big screen'.



回答2:

Read this blog post from the Android developers site on how to achieve this.



回答3:

You can also check build.prop

Tablets running ICS should have this set to tablet, phones would be phone/default

ro.build.characteristics=