Difference Between <Supports-Screens> and <Compatible-Screens> on Android

difference between supports-screens and compatible-screens on Android

supports-screens

However, if your application does not work well when resized to fit
different screen sizes, you can use the attributes of the
element to control whether your application should
be distributed to smaller screens or have its UI scaled up ("zoomed")
to fit larger screens using the system's screen compatibility mode.

compatible-screens

Any screen configuration that is not declared in this element is a screen with which the application is not
compatible. Thus, external services (such as Google Play) should not
provide the application to devices with such screens.

Source

So it seems supports-screens means your app's layout works well for particular screen and will be scaled in other screens

And compatible-screens means your app is compatible with only specific screens and devices. Devices with screen configurations other than those listed, won't be seen in the Play store.

Supporting Multiple Screens - usage of compatible-screens

After looking into this for two days (shame on me for taking this long), I looked into the AVD manager in Android Studio to find out that the Nexus 7, which has the same specs as my Acer Iconia, is considered Large, not Normal.
Once I changed the

<screen   android:screenSize="normal"  android:screenDensity="213"/>

to:

<screen   android:screenSize="large"  android:screenDensity="213"/>

and uploaded the new APK to the Play Store, my tablet was finally compatible with the app. I hope this helps somebody someday when they cant figure out why their tvdpi tablet is deemed not compatible with their app.

How to use support-screens and compatible-screens in android manifest?

"But its not mentioned whether both these labels can be used together."
Yes you can use both together in your manifest file.

As i had use same features for my application..!!

Android manifest and compatible-screens

Yes, it will, but on the other hand incompatible devices, i.e. other than normal, or xxhdpi and so on, won't be able to use your app.

It all varies across devices, you can have a large device that has low density. You'd use the large modifiers to create layout folders for specific sizes and at the same time drawables for different screen densities.

res/
layout/
main.xml // standard layout
layout-large/
main.xml // devices classified as "large" will load this layout

Suppose we have a tablet, it's going to load layout from layout-large folder, whereas a phone would load layout. But at the same time, if they have the same densities, for example xhdpi, both versions will use drawables located in drawable-xhdpi folder.

Here's an article that describes everything there is to know about adapting your app's resources to different displays.

What it is the use of support-screen tag in AndroidManifest

Quoting the Developers-Site:: Use these lines below in your manifest

<manifest ... >
<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" />
</compatible-screens>
...
<application ... >
...
<application>
</manifest>

Using these lines will make your app to work only on handsets !

Hope this Clears your Question !


{EDIT} - Reference

 /res/layout/layout.xml         // Default layout
/res/layout-small/layout.xml // Small screens
/res/layout-large/layout.xml // Large screens
/res/layout-xlarge/layout.xml // Ex

You can go even further and make also different layouts for portrait and landscape views by specyfing another keyword in directory's name:

 /res/layout-small-land/layout.xml      // Small screens, landscape view
/res/layout-small-portrait/layout.xml // Small screens, portrait view

Remember that tags order is important, so you can't write layout-portrait-small.

And in last add this code to your manifest file:

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

whenever you run application in any device according to that screen size that layout called

Will this work on all screen sizes?

Use this

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

An application "supports" a given screen size if it resizes properly
to fill the entire screen. Normal resizing applied by the system works
well for most applications and you don't have to do any extra work to
make your application work on screens larger than a handset device.
However, it's often important that you optimize your application's UI
for different screen sizes by providing alternative layout resources.
For instance, you might want to modify the layout of an activity when
it is on a tablet compared to when running on a handset device.

Please read official Document's about Declare Support for Tablet Screens & supports-screens . I hope it will helps you .

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

Courtesy Goes to Optimizing Android manifest file for largest number of supported devices

Android Support Screens doesn't work?

From the official source

Caution: The Android system does not pay attention to this attribute, so it does not affect how your application behaves at runtime. Instead, it is used to enable filtering for your application on services such as Google Play. However, Google Play currently does not support this attribute for filtering (on Android 3.2), so you should continue using the other size attributes if your application does not support small screens.

Update:

Looks like android:requiresSmallestWidthDp is not used at filtering at Google Play at all. Only android:smallScreens, android:normalScreens, android:largeScreens and android:xlargeScreens apply on it.

I did next tests:


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

or

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

Sample Image

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

or

<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:requiresSmallestWidthDp="360"/>

Sample Image

65 devices were added only


You can try to play around with <compatible-screens>

DESCRIPTION:

Specifies each screen configuration with which the application is
compatible. Only one instance of the element is
allowed in the manifest, but it can contain multiple
elements. Each element specifies a specific screen
size-density combination with which the application is compatible.

The Android system does not read the manifest
element (neither at install-time nor at runtime). This element is
informational only and may be used by external services (such as
Google Play) to better understand the application's compatibility with
specific screen configurations and enable filtering for users. Any
screen configuration that is not declared in this element is a screen
with which the application is not compatible. Thus, external services
(such as Google Play) should not provide the application to devices
with such screens.

Caution: Normally, you should not use this manifest element. Using this element can dramatically reduce the potential user base for your
application, by not allowing users to install your application if they
have a device with a screen configuration that you have not listed.
You should use it only as a last resort, when the application
absolutely does not work with specific screen configurations. Instead
of using this element, you should follow the guide to Supporting
Multiple Screens to provide scalable support for multiple screens
using alternative layouts and bitmaps for different screen sizes and
densities.

compatible-screens in Android

It looks like you are attempting to restrict screen sizes to only handsets, and not tablets. It is difficult to discern from your question, but either way I think I can clear up the confusion.

When you declare <compatible-screens> in your manifest you must declare every screen configuration that you would like your app to be compatible with:

You must declare each one of these; any combination of size and
density that you do not specify is considered a screen configuration
with which your application is not compatible.

I suspect the 5.5+ inch phones you mention have a higher density than xhdpi; such as xxhdpi or xxxhdpi. These densities are omitted from the documentation (either because the documentation is outdated or otherwise incomplete) but are still relevant; they are documented on the <compatible-screens> page.

Therefore if you want your app to be compatible with higher density devices, you must include those densities in your <compatible-screens> element. But an easier method would be to use the <supports-screens> element instead. As per the documentation, the <supports-screens> element does not take density into account:

Note: Although you can also use the <compatible-screens> element for the reverse scenario (when your application is not compatible with
smaller screens), it's easier if you instead use the
<supports-screens> as discussed in the next section, because it
doesn't require you to specify each screen density your application
supports.

With this you can just specify the following in your manifest:

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

The largestWidthLimitDp attribute should not be necessary, but 840dp seems like a good limit for handsets based on the Material Design documentation for density breakpoints.

Otherwise, you can still use the <compatible-screens> tag if you would like more fine-tuned control over which devices your app is compatible with:

<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" />
<screen android:screenSize="small" android:screenDensity="xxhdpi" />
<screen android:screenSize="small" android:screenDensity="xxxhdpi" />
<!-- 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" />
<screen android:screenSize="normal" android:screenDensity="xxhdpi" />
<screen android:screenSize="normal" android:screenDensity="xxxhdpi" />
</compatible-screens>


Related Topics



Leave a reply



Submit