androidpixel-density

Different AndroidManifest.xml for low resolution and high resolution


I'll have to split up my app (APK) in two chunks:

Now "low" and "high" here is very relative. Low comprises textures in 1x and 2x scales, and high is the same textures at 3x scale. Yes this is an app ported from iOS. Because of size reasons I'll have to make multiple APKs.

So, I have to draw the line somewhere, and I'll likely decide to use low res for devices up to 320 DPI, and high res for devices with DPI beyond that. Like 400 and up, or something. From what it looks like, we can separate DPIs by using the supported-screens tag in AndroidManifest.xml, but it's nowhere clear to me how that actually should be performed, as there is no way to specify the actual DPI. My knowledge might not be enough but I have a hard time grasping how to relate the thing "dp" (essentially points in iOS speak) to "dpi" i.e. density.

http://developer.android.com/guide/practices/screens_support.html

It looks like 320ish dpi in Android-speak is "xhdpi" and stuff above that is xxhdpi and so on (~480 dpi) according to the table:

The question is, how do we require a certain minimum DPI in the manifest file? Also, a maximum DPI would likewise have to be specified for the low res APK?


Solution

  • You don't need to create different APK. Just put the texture in the correct folder (drawable-mdpi, drawable-ldpi, drawable-hdpi, ...), Android will keep only the correct density folder for every device. This is why they made the "mipmap" folder for launcher icons:

    When app resource optimization techniques remove resources for unused screen densities, launcher icons can wind up looking fuzzy because the launcher app has to upscale a lower-resolution icon for display. To avoid these display issues, apps should use the mipmap/ resource folders for launcher icons.

    EDIT: If you really need to then try the compatible-screens tag...