Android app for tablets only

18

Developed an android app using Android Studio , in the% of files% of the screens I used the Nexus 10 layout because my app is only for tablets.

After I uploaded the app to Google Play store I saw that they had xml enabled devices to use my app, , smartphones and tablets.

How do I limit these devices to tablets only?

    
asked by anonymous 13.01.2014 / 20:08

2 answers

20

You can enable / disable the available screen types by updating the support-screens entry of your AndroidManifest.xml file:

<manifest ... >
    <supports-screens android:smallScreens="false"
                      android:normalScreens="false"
                      android:largeScreens="true"
                      android:xlargeScreens="true"
                      android:requiresSmallestWidthDp="600" />
    ...
    <application ... >
        ...
    </application>
</manifest>

Font

You can still find a full section of the documentation on support for different screens here

    
13.01.2014 / 20:11
8

According to this topic the manitest as mentioned in @hernandes's response prevents users from finding your application in the market place , but if they have the file apk they will not be prevented from installing it.

An additional protection would be to check the screen resolution at application startup and, if not appropriate, issue a "unsupported screen size" warning and terminate the application.

Following is a code example to retrieve the programmatically extracted values of this other topic :

Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics outMetrics = new DisplayMetrics ();
display.getMetrics(outMetrics);

float density  = getResources().getDisplayMetrics().density;
float dpHeight = outMetrics.heightPixels / density;
float dpWidth  = outMetrics.widthPixels / density;
    
13.01.2014 / 20:24