我有一个资源文件夹,数量为2-3 GBs.我想直接用obb在SD card中安装这个应用程序,因为有些用户不会有那么多的内部存储空间。
我目前正在寻找解决办法。
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="preferExternal"
... >我发现了这一点,它在外部存储上安装了apk,但没有在资源上安装。
我期望在默认情况下,必须有一个选项,在此选项中,apk安装在内部存储中,而sd-card上的资源则安装在其中。
发布于 2019-05-23 07:07:38
如果您希望默认情况下在外部sd卡中安装资源,请首先检查它们是否有用于它的资源。
if (android.os.Environment.getExternalStorageState().equals(
android.os.Environment.MEDIA_MOUNTED)) {
//Check for the file
File appFolder = new File(Environment.getExternalStorageDirectory() + File.separator
+ context.getString(R.string.app_name));
boolean exist = appFolder.exists();
}然后,只设置 if (exist == true){//your code here for the path} 的路径,尽管这并不明智,因为外部存储并不意味着它是SD卡。
https://stackoverflow.com/questions/56268864
复制相似问题