简体   繁体   中英

Limit android app only for Mobile phones not tablet

I want my application available only for mobile phones not for tablet. Here is what i have done

<?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>

But when i uploaded it on playstore and tried to search on my samsung galaxy s4 it was not there is search result.

What i am doing wrong.

Android makes it easy to develop an app that runs well on a wide range of device screen sizes and form factors. This broad compatibility works in your favor, since it helps you design a single app that you can distribute widely to all of your targeted devices. However, to give your users the best possible experience on each screen configuration — in particular on tablets — you need to optimize your layouts and other UI components for each targeted screen configuration. On tablets, optimizing your UI lets you take full advantage of the additional screen available, such as to offer new features, present new content, or enhance the experience in other ways to deepen user engagement.

Add this

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

An application "supports" a given screen size if it resizes properly to fill the entire screen. Normal resizing applied by the system works well for most applications and you don't have to do any extra work to make your application work on screens larger than a handset device. However, it's often important that you optimize your application's UI for different screen sizes by providing alternative layout resources. For instance, you might want to modify the layout of an activity when it is on a tablet compared to when running on a handset device.

Please read official Document's about Declare Support for Tablet Screens & supports-screens . I hope it will helps you .

If you do not specify a large screen size in manifest, it will not show up in tablet, so don't worry about that.

在此处输入图片说明

So, now it wont show up for tablets in the play store unless you do something to show up in play store.

You stated your app doesn't show up on the Samsung galaxy s4 :

Your app has permissions that the samsung galaxy s4 cannot handle. For example, if you try to access a camera on a device without a camera, then your app wont show up for that device. So, take a look at the permissions in the app you made, and look at the features of the s4, check which ones it cannot abide to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM