Search code examples
androidandroid-manifesttablet

Support phones and phablets, not tablets


I recently uploaded my apps to Play Store, which only support phones and phablets. So I insert below code to only support phones and phablets, according to https://developer.android.com/guide/practices/screens-distribution.html

    <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.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="com.xxx.yyy.permission.C2D_MESSAGE" />

    <compatible-screens>
      <screen android:screenSize="small" android:screenDensity="ldpi" />
      <screen android:screenSize="small" android:screenDensity="mdpi" />
      <screen android:screenSize="small" android:screenDensity="hdpi" />
      <screen android:screenSize="small" android:screenDensity="xhdpi" />
      <screen android:screenSize="small" android:screenDensity="xxhdpi" />
      <screen android:screenSize="small" android:screenDensity="xxxhdpi" />
      <screen android:screenSize="small" android:screenDensity="420" />
      <screen android:screenSize="small" android:screenDensity="480" />
      <screen android:screenSize="small" android:screenDensity="560" />
      <screen android:screenSize="small" android:screenDensity="640" />
      <!-- all normal size screens -->
      <screen android:screenSize="normal" android:screenDensity="ldpi" />
      <screen android:screenSize="normal" android:screenDensity="mdpi" />
      <screen android:screenSize="normal" android:screenDensity="hdpi" />
      <screen android:screenSize="normal" android:screenDensity="xhdpi" />
      <screen android:screenSize="normal" android:screenDensity="xxhdpi" />
      <screen android:screenSize="normal" android:screenDensity="xxxhdpi" />
      <screen android:screenSize="normal" android:screenDensity="420" />
      <screen android:screenSize="normal" android:screenDensity="480" />
      <screen android:screenSize="normal" android:screenDensity="560" />
      <screen android:screenSize="normal" android:screenDensity="640" />
    </compatible-screens>

    <application android:name=".AppApplication" 
android:allowBackup="false" 
android:icon="@mipmap/ic_launcher" 
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" 
android:supportsRtl="true" 
android:theme="@style/AppTheme" 
android:largeHeap="true"/>

The weird things start to kick in when Samsung S8 trying to install. It will have three of this possibilities. There're also similar occurrence to Huawei Mate 9.

  1. Able to find the app and install.
  2. Able to find the app but shows error 'Your device isn't compatible with this version'.
  3. Unable to find the app at all.

My question is, how do I solve this? The Google Play Console says all the devices is supported except tablets like I mentioned above. Or is it related to WQHD stuff that recent phones just implemented?

EDITED: The problem occurs only to those who upgraded to latest firmware, which enables the phone to support WQHD.


Solution

  • In addition to @Khalid answer, using <support-screens> will enable screen compatibility mode and let tablet users able to download.

    This is inevitable since <compatible-screens> cannot distinguish newer version of Android (or Samsung) which enable the users to set resolution dynamically (HD+, FHD+ and WQHD+) and cannot really pinpoint the Screen Density.

    In order to counter that, I add a validator on app launch to check screen size.

        public boolean checkUnsupportedSize() {
        int screenSize = this.getResources().getConfiguration().screenLayout &
                Configuration.SCREENLAYOUT_SIZE_MASK;
    
        switch(screenSize) {
            case Configuration.SCREENLAYOUT_SIZE_SMALL:
                return false;
            case Configuration.SCREENLAYOUT_SIZE_NORMAL:
                return false;
            default:
                return true;
        }
    }
    
        if (checkUnsupportedSize()) {
        YourActivity.this.finish();
    }
    

    Since phones and phablets will always using Screen Size of Small and Normal, we can distinguish others Screen Size and forcing the apps to quit.

    until Google Play make proper filtering for Phones, Phablets and Tablets, this is the workaround that I can think of.

    Cheers.