2

I am writing a media player application. It is best to see in 10 inch tablet, 7 inch tablet, 5 inch phone. So I wanna restrict my app to install to those devices only. How can I do that?

Here are my current manifest file values

<application
        android:hardwareAccelerated="true"
        android:allowBackup="true"
        android:icon="@drawable/logo_new"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:hardwareAccelerated="true"
            android:name="VideoActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen" 
            android:screenOrientation="sensorLandscape">

           <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter> 
        </activity>


    </application>
user3243163
  • 408
  • 2
  • 14
saa
  • 1,538
  • 2
  • 17
  • 35

1 Answers1

2

Try this:

Add the following things on your AndroidManifest.xml before <application> tag :

<supports-screens android:smallScreens="false"
              android:normalScreens="false"
              android:largeScreens="true"
              android:xlargeScreens="true"
              android:anyDensity="true"
              android:requiresSmallestWidthDp="480"
              android:compatibleWidthLimitDp="integer"
              android:largestWidthLimitDp="integer"/>

You can also follow the reference links::

http://android-developers.blogspot.in/2011/09/preparing-for-handsets.html

enter image description here

The above code automatically filters devices by Play Store.

Satyaki Mukherjee
  • 2,857
  • 1
  • 22
  • 26
  • ok... But this attribute android:requiresSmallestWidthDp="600" is for 7inch tablet. So will it allow to install on 5 inch screen – saa Jan 29 '14 at 09:57
  • @saa android:requiresSmallestWidthDp="600" this is just example, you can change this by your own. It's not mandatory to put 600 . You can replace with 480 – Satyaki Mukherjee Jan 29 '14 at 09:58
  • @saa no, it tells that device minimum requirement will be 480. If the device has more than that , then it will support for this device also, but not for less than 480. Generally 5 inch screens start with 480dp . So , I have assigned 480 – Satyaki Mukherjee Jan 29 '14 at 10:08
  • ok... i got it. thanks. Let me try your code. Then i will let you know if there are any issues. – saa Jan 29 '14 at 10:20
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/46336/discussion-between-saa-and-satyaki-mukherjee) – saa Jan 29 '14 at 12:05
  • what will be the integer values in these attributes android:compatibleWidthLimitDp="integer" android:largestWidthLimitDp="integer" – saa Jan 29 '14 at 12:07
  • @saa these two lines,i.e., android:compatibleWidthLimitDp="integer" android:largestWidthLimitDp="integer" is not necessary... if you want, then you can provide these lines...... – Satyaki Mukherjee Jan 29 '14 at 12:23
  • @saa if my answer will help you , then please accept my answer, which will boost me up :) – Satyaki Mukherjee Jan 29 '14 at 12:54
  • Actually i dont know whether it is right answer or not. I have to upload my app to store to test it. It may take one more week to verify your answer. – saa Jan 29 '14 at 12:57
  • @saa but you can test this before upload it to playstore . GO to APK on Developer console , see the supported device. On there give a name of normal screen mobile of "samsung galaxy y" or anything else. You can able to see this. – Satyaki Mukherjee Jan 29 '14 at 13:44
  • @SatyakiMukherjee I want my app to be available for only mobile devices & 7-inch tablets. By your answer, I got how to do that. But what if **screen compatibility mode** got activated? I want my app to be shown on play store to mobile & 7-inch tablets users only & not to 9 & 10-inch tablet users. –  Nov 07 '15 at 02:48