简体   繁体   中英

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.

Instead of <compatible-screens> you could use <supports-screens> as it doesn't require you to specify each screen density that your app supports.

Sample for handset devices:

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

Source:

Cheers.

EDITED UPDATED TO ANDROID OREO:

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

Probable logical cause: Issue these devices were previously suppressing their true screen (manufacturer / android os) resolution so the code was working as expected on all devices.

Issue arise on upgrading to new Android OS /Oreo that unleashed the true screen resolution features of the device.

Settings - Display - screen resolution (there are 3 setting)

Suggested test/verification is to set the resolution to the lowest. Try installing / run the app.

Ref: https://www.androidcentral.com/understanding-galaxy-s8s-display-resolution-options

This is definitely out of your code control at the moment as its a totally new upgrade to Android API 8.0 Oreo util documentation is provided, in the mean time you could have a work around to include max resolution of those devices or educate the users.

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.

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