限制Android应用程序仅适用于手机而非平板电脑

时间:2015-12-16 05:08:49

标签: android screen tablet

我希望我的应用程序仅适用于不适用于平板电脑的手机。这就是我所做的

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="soulvant.golfclub">

<compatible-screens>

    <!-- all small size screens -->
    <screen
        android:screenDensity="ldpi"
        android:screenSize="small" />
    <screen
        android:screenDensity="mdpi"
        android:screenSize="small" />
    <screen
        android:screenDensity="hdpi"
        android:screenSize="small" />
    <screen
        android:screenDensity="xhdpi"
        android:screenSize="small" />
    <!-- all normal size screens -->
    <screen
        android:screenDensity="ldpi"
        android:screenSize="normal" />
    <screen
        android:screenDensity="mdpi"
        android:screenSize="normal" />
    <screen
        android:screenDensity="hdpi"
        android:screenSize="normal" />
    <screen
        android:screenDensity="xhdpi"
        android:screenSize="normal" />
    <!-- all normal size screens -->
    <screen
        android:screenDensity="ldpi"
        android:screenSize="large" />
    <screen
        android:screenDensity="mdpi"
        android:screenSize="large" />
    <screen
        android:screenDensity="hdpi"
        android:screenSize="large" />
    <screen
        android:screenDensity="xhdpi"
        android:screenSize="large" />
</compatible-screens>


<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.android.launcher.permission.WRITE_SETTINGS" />

<!-- for Samsung badge -->
<uses-permission android:name="com.sec.android.provider.badge.permission.READ" />
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE" />

<!-- for htc badge -->
<uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT" />

<!-- for sony badge -->
<uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE" />

<!-- for apex badge -->
<uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />

<permission
    android:name="soulvant.golfclub.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="soulvant.golfclub.permission.C2D_MESSAGE" />

<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<!-- Network State Permissions to detect Internet status -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!-- Permission to vibrate -->
<uses-permission android:name="android.permission.VIBRATE" />

<application
    android:name=".utils.ApplicationClass"
    android:allowBackup="true"
    android:icon="@mipmap/launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:theme="@style/AppTheme"
    tools:node="replace">
    <meta-data
        android:name="DATABASE"
        android:value="aurous.db" />
    <meta-data
        android:name="VERSION"
        android:value="1" />
    <meta-data
        android:name="QUERY_LOG"
        android:value="true" />
    <meta-data
        android:name="DOMAIN_PACKAGE_NAME"
        android:value="soulvant.golfclub" />

    <activity
        android:name=".activities.SplashActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.MainActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.ProsActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.ProsDetailActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.ProDetailRateOffer"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.NewsActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.NewsDetailActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.EventsActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.EventDetailActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.CourseActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.CourseDetailActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.FacilityAvailableActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.CourseRateoffActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.RestaurantActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.RestaurantMenu"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.RestaurantDetailActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.RestaurantRatesActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.HotelsActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.HotelDetailActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.HotelPackageActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.HotelWebsiteActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.ProshopActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.ProshopDetailActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.CoursesSlideshow"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.ProshopRateOfferActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.BrowserActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".activities.AdvertisementActivity"
        android:screenOrientation="portrait" />

    <activity
        android:name=".activities.Advertisement"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Translucent" />

    <receiver
        android:name="com.google.android.gms.gcm.GcmReceiver"
        android:exported="true"
        android:permission="com.google.android.c2dm.permission.SEND">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />

            <category android:name="soulvant.golfclub" />
        </intent-filter>
    </receiver>

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <!-- [START gcm_listener] -->
    <service
        android:name=".MyGcmListenerService"
        android:exported="false">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        </intent-filter>
    </service>
    <!-- [END gcm_listener] -->
    <!-- [START instanceId_listener] -->
    <service
        android:name=".MyInstanceIDListenerService"
        android:exported="false">
        <intent-filter>
            <action android:name="com.google.android.gms.iid.InstanceID" />
        </intent-filter>
    </service>
    <!-- [END instanceId_listener] -->
    <service
        android:name=".RegistrationIntentService"
        android:exported="false" />
</application>

但是当我把它上传到Playstore并尝试搜索我的三星Galaxy s4时,搜索结果并不存在。

我做错了什么。

2 个答案:

答案 0 :(得分:1)

  

Android可以轻松开发适用范围广泛的应用   设备屏幕尺寸和外形尺寸。这种广泛的兼容性   对你有利,因为它可以帮助你设计一个你的应用程序   可以广泛分发到您的所有目标设备。但是,要   在每个屏幕上为您的用户提供最佳体验   配置 - 特别是在平板电脑上 - 您需要优化您的   每个目标屏幕的布局和其他UI组件   组态。在平板电脑上,优化您的UI可让您充分利用   附加屏幕的优点,例如提供新的   功能,呈现新内容或以其他方式增强体验   加深用户参与度。

添加此

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

如果应用程序正确调整大小,它将“支持”给定的屏幕大小   填满整个屏幕。系统应用的正常大小调整有效   适用于大多数应用程序,您无需进行任何额外的工作   使您的应用程序在比手机设备更大的屏幕上工作。   但是,优化应用程序的UI通常很重要   通过提供替代布局资源来实现不同的屏幕尺寸   例如,您可能希望在何时修改活动的布局   与在手机设备上运行时相比,它在平板电脑上。

请阅读官方文档中有关 Declare Support for Tablet Screens &amp; supports-screens 。我希望它会对你有所帮助。

答案 1 :(得分:-1)

如果您没有在清单中指定大屏幕尺寸,它将不会显示在平板电脑中,因此请不要担心。

enter image description here

所以,现在它不会出现在游戏商店中的平板电脑,除非你做了一些东西出现在游戏商店。

您声明您的应用未显示在Samsung galaxy s4上:

您的应用拥有三星Galaxy s4无法处理的权限。例如,如果您尝试在没有摄像头的设备上访问摄像头,那么您的应用程序将不会显示该设备。因此,请查看您制作的应用中的权限,并查看s4的功能,检查哪些功能无法遵守。