0

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?

  • 1
    there is one way that you can determine device screen inch, check out this answer http://stackoverflow.com/a/5789916/582571 – rajpara Aug 16 '12 at 04:15

2 Answers2

2

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

jeet
  • 29,001
  • 6
  • 52
  • 53
1

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.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
  • I declared this in the manifest file..but still i can run my app in smaller devices..how can i test this before publishing?is there any way? – user1374913 Aug 16 '12 at 04:57