Chronos
Chronos

Reputation: 1962

How to support phones up to 4.0, excluding tablets?

There is an easy way to provide compatibility for phones up to 4.0, but excluding tablets?

For example, can I:

<uses-sdk
        android:minSdkVersion="4"
        android:targetSdkVersion="14" />

And then set:

<supports-screens
        android:anyDensity="true"
        android:xlargeScreens="false"
        android:largeScreens="true"
        android:normalScreens="true"
        android:resizeable="true"
        android:smallScreens="true" />

This config filter the tablets from market?

Many thanks for the help!

Upvotes: 2

Views: 2914

Answers (2)

Michell Bak
Michell Bak

Reputation: 13252

First of all, let me be very clear in pointing out that this is not recommended. Google wants developers to create apps that work on pretty much all devices, but if you insist, it's kind of possible to do.

What you'll need to do first is define what a tablet is. My definition of a tablet - in Android terms - is a device that has a screen size of large or x-large. Devices with a normal or small screen are usually mobile phones. There are some exceptions, though. You can use this illustration as a reference:

enter image description here

Anyway, once you're happy with your definition of a tablet, you can just set the supports-screen tag in the manifest to the following:

<supports-screens
        android:anyDensity="true"
        android:xlargeScreens="false"
        android:largeScreens="false"
        android:normalScreens="true"
        android:smallScreens="true" />

Also, you want to target the latest API level in your manifest (which was level 15 as of this post):

<uses-sdk
        android:minSdkVersion="4"
        android:targetSdkVersion="15" />

Again - this is NOT recommended. You should try to work on a layout that will also work on tablets. A tablet optimized layout would be even better, but at least make it work on tablets.

Upvotes: 4

KDEx
KDEx

Reputation: 3667

In addition to what you already outlined when you publish the device you can select the specific devices that you do not want your app to be available on. The option is near the bottom under "Compatible Devices" This will take out any guesswork.

Upvotes: 2

Related Questions