Reputation: 13
How can i prevent my application from running in smaller devices like phones..i need my app to run on only android tablets..what is the solution?
Upvotes: 0
Views: 138
Reputation: 29199
To run application for tablets only, you can set supports screen size attribute in manifest file, as follows:
<supports-screens android:smallScreens="false"
android:normalScreens="false"
android:largeScreens="true"
android:xlargeScreens="true"
android:requiresSmallestWidthDp="600" />
Referenced from link
Upvotes: 2
Reputation: 881543
You can specify compatible screen sizes and densities in your manifest file:
<compatible-screens>
<screen android:screenSize=["small" | "normal" | "large" | "xlarge"]
android:screenDensity=["ldpi" | "mdpi" | "hdpi" | "xhdpi"] />
:
</compatible-screens>
Keep in mind that this is advisory rather than enforced. There is a supports-screens
tag which is enforced:
<supports-screens android:resizeable=["true"| "false"]
android:smallScreens=["true" | "false"]
android:normalScreens=["true" | "false"]
android:largeScreens=["true" | "false"]
android:xlargeScreens=["true" | "false"]
android:anyDensity=["true" | "false"]
android:requiresSmallestWidthDp="integer"
android:compatibleWidthLimitDp="integer"
android:largestWidthLimitDp="integer"/>
However, this method of restriction is usually frowned upon and will limit your potential market (though I myself have used it in an application where it makes zero sense to run on small screens, so I understand your request).
See this link for possible strategies to avoid it.
Upvotes: 1