I have separate APKs for the same app. For tablets and for handsets.
Also I'm using expo in my project.
Due to android documentation I should declare <supports-screens> in <manifest> like this for tablet support only:
<manifest ... >
<supports-screens android:smallScreens="false"
android:normalScreens="false"
android:largeScreens="true"
android:xlargeScreens="true"/>
</manifest>
But it's not good solution, because eject is necessary. How can solve my problem without expo eject ?
I used this answer (among others) to help me piece together how to do this. Here is my plugin file to add <supports-screens> in <manifest>:
const { withAndroidManifest } = require("@expo/config-plugins")
function addAttributesToManifest(androidManifest) {
const { manifest } = androidManifest;
const supportsScreens = {};
supportsScreens.$ = {
...supportsScreens.$,
...{
"android:smallScreens": false,
"android:normalScreens": false,
"android:largeScreens": true,
"android:xlargeScreens": true,
},
};
manifest["supports-screens"] = supportsScreens;
return androidManifest
}
module.exports = function withSupportsScreens(config) {
return withAndroidManifest(config, (config) => {
config.modResults = addAttributesToManifest(config.modResults);
return config;
});
};
Run expo prebuild --platform android --no-install and check that android/app/src/main/AndroidManifest.xml now contains <supports-screens>. Make sure to delete the generated android folder when you're done setting up your plugin so that EAS does not assume a bare workflow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With