I am trying to make my ionic/ Cordova app to not support small screens. So I have this below inside my config.xml at the root of the project folder :
<config-file parent="/" target="AndroidManifest.xml">
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="false" />
</config-file>
Although the config.xml generated inside \platform\android\res\xml\ has the below content fine:<config-file parent="/" target="AndroidManifest.xml">
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="false" />
</config-file>
, the output AndroidManifest.xml shows <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true"/>
.
So basically, my screen related config is ignored, it only do the default.
How do I actually turn off small screen support?
Make sure you have installed the cordova-custom-config plugin (cordova plugin add cordova-custom-config)
Make sure you have added the Android namespace attribute
From the documentation : In order to user the android: namespace in preferences within your config.xml, you must include the android namespace attribute on the root <widget>
element. The namespace attribute fragment is:
xmlns:android="http://schemas.android.com/apk/res/android"
Make sure you have defined <config-file target="AndroidManifest.xml" parent="/*">
element inside the android platform element (<platform name="android">
), otherwise it will be ignored.
Source: https://www.npmjs.com/package/cordova-custom-config
at the Very beginning of your index.html, use JavaScript to find the windowheight and windowwidth of the device, if they are smaller than some figures, prompt the user that the device is not supported.
Actually, in my own app, I allow all screen size, but I never use actual figures in my css, for example, I do not use fontsize: 20 px, I set fontsize by JavaScript to a value that equals to some ratio of the screen height, so that no matter how small or big the screen is, all the font-size, image size, table width, whatever, display at a correct ratio in all devices among all platforms.