NeatoCode Techniques
Android Phones Leave Retina DPI in the Dust - Is Your App Ready?
HTC and Verizon just announced the Droid DNA, a five inch 1080P display super phone with 440DPI pixel density. This means graphics can be shown in incredible detail, with pixels so small they can’t be individually distinguished and detract from the content. A typical retina product has 264DPI, so this more than exceeds the challenge of matching that.
This latest phone is being offered on one of the few major US carriers, and being marketed under the powerful Droid brand that produced so many hits. While there have been a couple phones with similar screens released recently, this phone is one you will be sure to see in your user base for Android apps.
In Android, display densities are broken up into logical density buckets of LDPI, MDPI, HDPI, XHDPI. Now there is also an XXHDPI constant in the DisplayMetrics. class corresponding to the 480DPI logical screen density as well. By default the system will scale resources up to this size, but you can also provide resources specifically for it in folders with qualifying names like drawable-xxhdpi in the res folder of your app.
The biggest issue we’ve discovered at HTC testing apps on this device is that some apps are limiting themselves only to a specific set of densities using the compatible screens element. This is highly not recommended. The Google documentation phrases it like this:

Caution: Normally, you should not use this manifest element. Using this element can dramatically reduce the potential user base for your application, by not allowing users to install your application if they have a device with a screen configuration that you have not listed. You should use it only as a last resort, when the application absolutely does not work with all screen configurations. Instead of using this element, you should follow the guide to Supporting Multiple Screens, in order to provide complete support for multiple screens, by adding alternative resources for different screen sizes and densities.

Every app we found that uses this element to only show on a couple density classes, actually worked fine on the new device. Android layouts are generally written to fit the screen and scale or show more or less content to adjust for resolution and aspect ratio differences.
Without modification, however, these apps will not be available for download on the new device. This can hurt downloads significantly because of the heavy marketing and reach in this case. If you have a compatible-screens element in your AndroidManifest.xml like the below, the best thing to do is to remove it:
<uses-sdk ...
<compatible-screens>
    <!--no small size screens -->
 
    <!-- all normal size screens -->
    <screen android:screenSize="normal" android:screenDensity="ldpi" />
    <screen android:screenSize="normal" android:screenDensity="mdpi" />
    <screen android:screenSize="normal" android:screenDensity="hdpi" />
    <screen android:screenSize="normal" android:screenDensity="xhdpi" />
 
    <!-- all large size screens -->
    <screen android:screenSize="large" android:screenDensity="ldpi" />
    <screen android:screenSize="large" android:screenDensity="mdpi" />
    <screen android:screenSize="large" android:screenDensity="hdpi" />
    <screen android:screenSize="large" android:screenDensity="xhdpi" />
 
    <!-- all xlarge size screens -->
    <screen android:screenSize="xlarge" android:screenDensity="ldpi" />
    <screen android:screenSize="xlarge" android:screenDensity="mdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="hdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="xhdpi" />
</compatible-screens>
<application ...

Not having it in the AndroidManifest.xml will maximize your app’s downloads:
<uses-sdk ...

<application ...

If you cannot do that for some reason, the next best thing to do is to add an extra line to support the new density:
<uses-sdk ...
<compatible-screens>
    <!--no small size screens -->
 
    <!-- all normal size screens -->
    <screen android:screenSize="normal" android:screenDensity="ldpi" />
    <screen android:screenSize="normal" android:screenDensity="mdpi" />
    <screen android:screenSize="normal" android:screenDensity="hdpi" />
    <screen android:screenSize="normal" android:screenDensity="xhdpi" />
    <screen android:screenSize="normal" android:screenDensity="480" />
 
    <!-- all large size screens -->
    <screen android:screenSize="large" android:screenDensity="ldpi" />
    <screen android:screenSize="large" android:screenDensity="mdpi" />
    <screen android:screenSize="large" android:screenDensity="hdpi" />
    <screen android:screenSize="large" android:screenDensity="xhdpi" />
 
    <!-- all xlarge size screens -->
    <screen android:screenSize="xlarge" android:screenDensity="ldpi" />
    <screen android:screenSize="xlarge" android:screenDensity="mdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="hdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="xhdpi" />
</compatible-screens>
<application ...

In the current build tools 480 has to be used instead of xxhdpi, although the string version will work soon. These changes will allow your app to be downloaded on new XXHDPI density class devices and take advantage of all those nice marketing dollars being spent right now to drive users to the device, who will then hungrily look for apps. :)
Summary
Step 1 - Make sure your app appears to XXHDPI devices so you can get the most downloads. Remove any compatible-screens element in your AndroidManifest.xml.
Step 2 - Provide density specific graphics if desired for perfect crispness at the new resolution.
Hope that helps you all take advantage of this new opportunity when you are coding! Let’s make some apps that show off this new display advantage Android has over other platforms. :)

Android Phones Leave Retina DPI in the Dust - Is Your App Ready?

HTC and Verizon just announced the Droid DNA, a five inch 1080P display super phone with 440DPI pixel density. This means graphics can be shown in incredible detail, with pixels so small they can’t be individually distinguished and detract from the content. A typical retina product has 264DPI, so this more than exceeds the challenge of matching that.

This latest phone is being offered on one of the few major US carriers, and being marketed under the powerful Droid brand that produced so many hits. While there have been a couple phones with similar screens released recently, this phone is one you will be sure to see in your user base for Android apps.

In Android, display densities are broken up into logical density buckets of LDPI, MDPI, HDPI, XHDPI. Now there is also an XXHDPI constant in the DisplayMetrics. class corresponding to the 480DPI logical screen density as well. By default the system will scale resources up to this size, but you can also provide resources specifically for it in folders with qualifying names like drawable-xxhdpi in the res folder of your app.

The biggest issue we’ve discovered at HTC testing apps on this device is that some apps are limiting themselves only to a specific set of densities using the compatible screens element. This is highly not recommended. The Google documentation phrases it like this:

Caution: Normally, you should not use this manifest element. Using this element can dramatically reduce the potential user base for your application, by not allowing users to install your application if they have a device with a screen configuration that you have not listed. You should use it only as a last resort, when the application absolutely does not work with all screen configurations. Instead of using this element, you should follow the guide to Supporting Multiple Screens, in order to provide complete support for multiple screens, by adding alternative resources for different screen sizes and densities.

Every app we found that uses this element to only show on a couple density classes, actually worked fine on the new device. Android layouts are generally written to fit the screen and scale or show more or less content to adjust for resolution and aspect ratio differences.

Without modification, however, these apps will not be available for download on the new device. This can hurt downloads significantly because of the heavy marketing and reach in this case. If you have a compatible-screens element in your AndroidManifest.xml like the below, the best thing to do is to remove it:

<uses-sdk ...
<compatible-screens>
    <!--no small size screens -->
 
    <!-- all normal size screens -->
    <screen android:screenSize="normal" android:screenDensity="ldpi" />
    <screen android:screenSize="normal" android:screenDensity="mdpi" />
    <screen android:screenSize="normal" android:screenDensity="hdpi" />
    <screen android:screenSize="normal" android:screenDensity="xhdpi" />
 
    <!-- all large size screens -->
    <screen android:screenSize="large" android:screenDensity="ldpi" />
    <screen android:screenSize="large" android:screenDensity="mdpi" />
    <screen android:screenSize="large" android:screenDensity="hdpi" />
    <screen android:screenSize="large" android:screenDensity="xhdpi" />
 
    <!-- all xlarge size screens -->
    <screen android:screenSize="xlarge" android:screenDensity="ldpi" />
    <screen android:screenSize="xlarge" android:screenDensity="mdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="hdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="xhdpi" />
</compatible-screens>
<application ...

Not having it in the AndroidManifest.xml will maximize your app’s downloads:

<uses-sdk ...

<application ...

If you cannot do that for some reason, the next best thing to do is to add an extra line to support the new density:

<uses-sdk ...
<compatible-screens>
    <!--no small size screens -->
 
    <!-- all normal size screens -->
    <screen android:screenSize="normal" android:screenDensity="ldpi" />
    <screen android:screenSize="normal" android:screenDensity="mdpi" />
    <screen android:screenSize="normal" android:screenDensity="hdpi" />
    <screen android:screenSize="normal" android:screenDensity="xhdpi" />
    <screen android:screenSize="normal" android:screenDensity="480" />
 
    <!-- all large size screens -->
    <screen android:screenSize="large" android:screenDensity="ldpi" />
    <screen android:screenSize="large" android:screenDensity="mdpi" />
    <screen android:screenSize="large" android:screenDensity="hdpi" />
    <screen android:screenSize="large" android:screenDensity="xhdpi" />
 
    <!-- all xlarge size screens -->
    <screen android:screenSize="xlarge" android:screenDensity="ldpi" />
    <screen android:screenSize="xlarge" android:screenDensity="mdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="hdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="xhdpi" />
</compatible-screens>
<application ...

In the current build tools 480 has to be used instead of xxhdpi, although the string version will work soon. These changes will allow your app to be downloaded on new XXHDPI density class devices and take advantage of all those nice marketing dollars being spent right now to drive users to the device, who will then hungrily look for apps. :)

Summary

Step 1 - Make sure your app appears to XXHDPI devices so you can get the most downloads. Remove any compatible-screens element in your AndroidManifest.xml.

Step 2 - Provide density specific graphics if desired for perfect crispness at the new resolution.

Hope that helps you all take advantage of this new opportunity when you are coding! Let’s make some apps that show off this new display advantage Android has over other platforms. :)

  1. neatocode posted this
Blog comments powered by Disqus