Android app for tablets only

Asked

Viewed 389 times

18

I developed an android app using Android Studio, in the archives xml of the screens I used the layout of Nexus 10 because my application is only for tablets.

After I moved the app up to the Google Play saw that they had 4194 devices enabled to use my app, ie smartphones and tablets.

How do I limit these devices to tablets only?

  • You want to avoid or ban the use in cell phones?

  • @utluiz I want to ban, because I do not know what will be the behavior of the app on smaller screens.

2 answers

20


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

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

Source

You can still find a full section of documentation on different screen support here

  • 1

    That’s right @Ernandes! I put that code on manifest and I climbed a new apk to the store, now appeared only 711 devices.

8

According to this topic the configuration of manitest, as mentioned in the @Ernandes reply, prevents users from finding their app on market place, but if they have the file apk in hands they will not be prevented from installing the same.

Additional protection would consist of checking the screen resolution on application startup and, if not appropriate, issuing a "unsupported screen size" warning and terminating the application.

Here is an example of code to retrieve 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;
  • I did not know this possibility @utluiz, I will add in my code and test, vlw.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.