发布应用 - 在Android电子市场中按设备限制

时间:2012-01-09 09:22:08

标签: java android google-play

我即将在市场上发布我的Android应用程序,但是我决定只为具有正常屏幕尺寸和高密度的设备(例如HTC Desire)设计它。

除了与HTC Desire具有相同规格的设备之外,此应用程序在任何其他设备上看起来都不正确。

我想知道如何限制市场上的应用以符合这些规格?

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package=""
      android:versionCode="1"
      android:versionName="1.0" android:installLocation="auto">

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

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-sdk android:minSdkVersion="8" />

    <application android:icon="@drawable/icon" android:label="@string/app_name" android:screenOrientation="landscape">
        <activity android:name=".PhonegapScreenshotPluginActivity"
                  android:label="@string/app_name"
                  android:configChanges="orientation|keyboardHidden" android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>

2 个答案:

答案 0 :(得分:6)

如果您的应用适用于Android 3.2及更高版本,则可以使用:

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

否则你可以使用:

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

查看以下网址:

http://developer.android.com/guide/topics/manifest/supports-screens-element.html

http://developer.android.com/guide/practices/screens_support.html

此外,我想与您分享以下文字:

当我们说普通屏幕时意味着什么?

  

我们告诉Android我们只支持正常的设备   屏幕类。请注意,这并不一定意味着我们的   应用程序不再可以在其他设备上安装。它没有   甚至意味着它注定要打破它们,但它还有其他   影响。我们没有提到像素或密度的实际尺寸   dpi的。

有关详细信息,请参阅第146页 http://www.manning.com/collins/AiP_sample_ch04.pdf

答案 1 :(得分:2)

还有一个清单元素,在您的情况下可以更有用。这是文档页面的link。在Manifest中它看起来像这样:

   <compatible-screens>
    <screen android:screenSize="normal" android:screenDensity="hdpi" />
   </compatible-screens>

希望这有帮助。

相关问题