Last active
January 1, 2023 23:37
-
-
Save wodin/b7393dc2c5c18fd85d522d34785eae10 to your computer and use it in GitHub Desktop.
Allowing an Android app to be moved to an SD card by the user (untested)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Need to specify the `installLocation`. Can do this with a config plugin --> | |
<!-- See `app.json` and `withAndroidManifestAttributes.js` below --> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.example.myapp" | |
android:installLocation="auto"> | |
... | |
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"expo": { | |
// ... | |
"plugins": [ | |
[ | |
"./withAndroidManifestAttributes", | |
{ | |
"android:installLocation": "auto" | |
} | |
] | |
] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { withAndroidManifest } = require("@expo/config-plugins"); | |
function addAttributesToApplication(androidManifest, attributes) { | |
const { manifest } = androidManifest; | |
manifest.$ = { ...manifest.$, ...attributes }; | |
return androidManifest; | |
} | |
module.exports = function withAndroidManifestAttributes(config, attributes) { | |
return withAndroidManifest(config, (config) => { | |
config.modResults = addAttributesToApplication( | |
config.modResults, | |
attributes | |
); | |
return config; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment