0

I need to limit my app to only run on screen small, medium and large screens but not xlarge. I can't write it in the manifest since the build is on 2.2.

OrhanC1
  • 1,415
  • 2
  • 14
  • 28

2 Answers2

3

Use <compatible-screens>, such as:

<compatible-screens>
    <!-- all small size screens -->
    <screen android:screenSize="small" android:screenDensity="ldpi" />
    <screen android:screenSize="small" android:screenDensity="mdpi" />
    <screen android:screenSize="small" android:screenDensity="hdpi" />
    <screen android:screenSize="small" android:screenDensity="xhdpi" />
    <!-- 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" />
</compatible-screens>

I can't write it in the manifest since the build is on 2.2.

You act as though you have a choice. You do not. Change your project's build target to API Level 9.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
1

You won't need to do anything in the manifest file. The xlarge tag was introduced in Android 2.3, so it won't be relevant in your case.

Updated If you want to make sure that xlarge devices can't use it, you should put this in your application manifest file and change the target API to level 9 (Android 2.3, in which the tag was introduced) and the minimum SDK level to something lower, i.e. 8 for Android 2.2.

<supports-screens
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:xlargeScreens="false" />
Michell Bak
  • 13,182
  • 11
  • 64
  • 121