Search code examples
androidandroid-manifestgoogle-playscreen-size

How do you specify in AndroidManifest.xml that you want to forbid installing on devices smaller than a 4.7-inch device?


I have a game that feels best on 7-inch tablets, and feels acceptably nice on 10-inch tablets and 5-inch Samsung Note-size devices. It's even just passably fun on something the size of a Nexus 4 phone or an S3. It is not at all fun to play on anything smaller. That being the case, how can a Manifest be written such that it can install on anything from a 4.7-inch device to a 10-inch tablet while being restricted from smaller phones?

EDIT

Stepping back for a moment, the reason for this question is because I find the documentation on the Android developer website to be incredibly confusing and conflicting. Let's give some examples to show just where the confusion comes from :

Let's take for example a couple of different devices.

Droid 3

  • 4-inch display
  • 540x960 px
  • 275 ppi

Looking at the documentation for supports-screens, we can infer that...

  • At 4 inches it may be on the bare edge of "large" but probably medium
  • At 540x960 it is well within the minimum for "large"
  • at 275 ppi it claims to be an hdpi screen

However, this device is far smaller than one that I would want to support... but the documentation makes it seem like on 2 of 3 counts, this device has a "Large" screen. By no sane definition of the term is a 4-inch screen "Large." Now, let's go further...

Nexus 4

  • 4.7 inch display
  • 768x1280 px
  • 318 ppi

Looking at the documentation for supports-screens, we can infer that...

  • This screen's physical dimensions are right on the border of Medium and Large
  • The pixel dimensions would indicate that it could be xlarge
  • The ppi indicate that it is an xhdpi device

Again, by no sane definition is a 4.7 inch screen "xlarge"... The screen's size is possibly just large enough to make the game enjoyable, but is it a "medium" screen? A "large" screen? How can you possibly know?

Would both of the above phones be "Medium"? Would the Droid be "Medium" while the Nexus "Large"? Why or why not? And if the Nexus is "Large" then how is that distinct from a 7 inch tablet, which also should be "Large?"

And then there's the fact that the docs claim that supports-screens/size is deprecated as of 3.2 anyway

But then there's no clear guidance on what to use in its place if one wants to support both old phones (assuming proper physical screen size in inches) and new tablets, or if there is it's hidden well out in the woods. Can someone lay out clearly what cretieria really matter and why a given device will fit a given filter or fail it?


Solution

  • Unfortunately, there is NO way to filter-out devices according to their 'PHYSICAL' sizes, which is what you want.

    There are two reasons.

    1. There are only four types of screen sizes: small, normal, large and x-large. This is too coarse. You want much higher granularity: 'filter out devices which LCD is less than 4.7 inch', which is not supported in current Android platform.
    2. Screen size is determined by the logical density which can be set to a value far different than the physical density. For exaple, let's assume that a device has 5 inch screen with physical density of 180 ppi. This is probably the screen that you want to support. However, for some reason, the manufacturer decide to set the logical density of the device as 320 dpi. Then the device is categorized as small screen device regardless of its physical density.

    For your reference, let me show you the internal logic that determines the screen size from the logical density and screen pixel count.

    http://androidxref.com/4.0.4/xref/frameworks/base/services/java/com/android/server/wm/WindowManagerService.java#5899