Why are xxhdpi
and xxxhdpi
not allowed values for screenDensity
parameter of <screen>
element in Manifest?
I'm trying to restrict usage of my app on tablets using the recommended solution from official Android Developers website - Declaring an App is Only for Handsets. I want to mark only small and normal screen sizes (with any density) as compatible:
<compatible-screens>
<!-- all small size screens -->
<screen
android:screenDensity="ldpi"
android:screenSize="small" />
<screen
android:screenDensity="mdpi"
android:screenSize="small" />
<screen
android:screenDensity="hdpi"
android:screenSize="small" />
<screen
android:screenDensity="xhdpi"
android:screenSize="small" />
<!-- all normal size screens -->
<screen
android:screenDensity="ldpi"
android:screenSize="normal" />
<screen
android:screenDensity="mdpi"
android:screenSize="normal" />
<screen
android:screenDensity="hdpi"
android:screenSize="normal" />
<screen
android:screenDensity="xhdpi"
android:screenSize="normal" />
</compatible-screens>
However, adding
<screen
android:screenDensity="xxhdpi"
android:screenSize="normal" />
is not allowed. Doesn't compile with Error: String types not allowed (at 'screenDensity' with value 'xxhdpi').
The same happens for 'xxxhdpi'.
I found out that inserting integer for corresponding density (e.g. screenDensity="480"
) works, but I'm wondering why doesn't it allow string expressions for all existing density buckets?
The android developer guide for screen density seems to agree with what you've experienced. It also mentions that for xxhdpi and higher you'll have to manually enter the dpi values. As to why, it doesn't really say...
http://developer.android.com/guide/topics/manifest/compatible-screens-element.html
Note: This attribute currently does not accept xxhdpi as a valid value, but you can instead specify 480 as the value, which is the approximate threshold for xhdpi screens.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With