0

When I mount 3 OBB files one after another to the same app they are created with different paths. After that context.getAssets() returns only the last one.

How can I mount them to one path and have all the data?

Or how can I switch between them after they are mounted ?

user2863638
  • 121
  • 7

1 Answers1

2

How about storing the filepath after every successfull mount! Maybe something like that will do it?:

public String mountObbFile(String filepathToObb){
    final Sting obbMountPath;
    final StorageManager storageManager = (StorageManager) getSystemService(STORAGE_SERVICE);
    storageManager.mountObb(filepathToObb, null , new OnObbStateChangeListener() {
        @Override
        public void onObbStateChange(String path, int state) {
            super.onObbStateChange(path, state);
            if (state == OnObbStateChangeListener.MOUNTED) {

                StorageManager storage = (StorageManager) getSystemService( STORAGE_SERVICE );
                obbMountPath = storage.getMountedObbPath( obbFilePath );
            } else {
                Log.i("OBB-MOUNT" , "state: " + state); 
                obbMountPath = "ERROR";
            }
        }
    });
    return obbMountPath;
}

String mountPath1 =  mountObbFile (filepathToObb1);
String mountPath2 =  mountObbFile (filepathToObb2);
String mountPath3 =  mountObbFile (filepathToObb3);
lx222
  • 248
  • 1
  • 16