I developed an application, Now i want to restrict the application for tablet.
Means the application should not run on any tablets. For that I specify the support-screens in Androidmenifest.XML file as:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abc.xyz"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="5"
android:targetSdkVersion="17"
android:maxSdkVersion="17" />
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="false"
android:xlargeScreens="false"
android:resizeable="true"
android:anyDensity="true" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:icon="@drawable/appicon"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:allowBackup="true" >
<activity
android:name="com.abc.xyz.activities.hello"
android:label="@string/title_activity_hello" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Now the issue is that :
Application is running on tablet
android:largeScreens="false"
android:xlargeScreens="false"
After declaring above too.
Now what should i do. Please suggest me and guide me.
From the settings menuSelect the one you want to remove. At the bottom of the screen, there should be an option to disable or uninstall it. Select the appropriate option and confirm the removal. If there is no option to uninstall or disable the app, this means it's a system app that can't be disabled.
You can uninstall apps you've installed on your phone. If you remove an app you paid for, you can reinstall it later without buying it again. You can also disable system apps that came with your phone.
Go to Settings -> Apps. Select the app you want to disable. In the App info window choose “Force stop” if that option is not greyed. This will stop all the process of the app and stop it.
This prevents access on tablets, but allows the new density buckets (xxhdpi and xxxhdpi) and avoids errors on projects that are compiled against lower SDKs. It should be a direct child of the <manifest>
element in AndroidManifest.xml
<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="480" /> <screen android:screenSize="small" android:screenDensity="640" /> <!-- 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="480" /> <screen android:screenSize="normal" android:screenDensity="560" /> <screen android:screenSize="normal" android:screenDensity="640" /> </compatible-screens>
Update 8.8.2016 Add this line if you want to support Nexus-5x-like devices with 420 density
<screen android:screenSize="normal" android:screenDensity="420" />
Include following 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" /> <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> </manifest>
This will help you.
If you want to restrict the app to handsets only use the <compatible-screens>
tag in the Manifest. i.e.like this
<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>
For more info check Declaring an App is Only for Handsets
You should not use the <supports-screens>
tag, if you want to restrict the app from tablets. It is clearly mentioned in the official doc
Caution: If you use the element for the reverse scenario (when your application is not compatible with larger screens) and set the larger screen size attributes to "false", then external services such as Google Play do not apply filtering. Your application will still be available to larger screens, but when it runs, it will not resize to fit the screen. Instead, the system will emulate a handset screen size (about 320dp x 480dp; see Screen Compatibility Mode for more information). If you want to prevent your application from being downloaded on larger screens, use , as discussed in the previous section about Declaring an App is Only for Handsets.
please check if you have made layout for layout-large, layout-xlarge. if they are present your app will run on tablet, please remove that layout folder if present.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With