1

I have a resources folder amounting 2-3 GBs. I want to install the app with the obb in SD card directly as some users won't be having that much internal storage.

I am currently searching for the solution.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    android:installLocation="preferExternal"
    ... >

I found out about this which installs the apk on external storage, but not the resources.

I am expecting that by default there must be an option in which apk is installed in the internal storage while the resources on the sd-card.

Nick Bapu
  • 463
  • 1
  • 4
  • 14
  • AFAIK you can not modify Manifest properties at runtime. So its should either one .. – ADM May 23 '19 at 06:06
  • You're confused on storage. External storage != SD card. External storage is a separate set of directories that can be anywhere but generally are on the internal storage. In the old days, this set of directories was world read/write (now it isn't, mostly). The SD card is a different thing entirely. Yes, this is confusing, and horrible terminology. Especially since there's now very little difference between internal and external storage in modern Android. – Gabe Sechan May 23 '19 at 06:09
  • @GabeSechan Thank you! Okay, so mostly there isn't any way to install the obb directly to sd-card, unless the end-user is doing it manually? – wallcrawler May 23 '19 at 06:16

1 Answers1

0
  1. Well you first need the path the user wants the resources to be downloaded in.

  2. Use AsyncTask to download zip file of the resource files (You can also check this thread here for more details)

  3. Unzip the files to the select path and then delete the the zip file

if you want the resources to be installed by default in the external sd card first check if they have one for it

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();
}

then just set the path to it if (exist == true){//your code here for the path} though it is not wise as an external storage does not mean that it is a SD card