Tuesday, 15 April 2014

storage - Android - OnObbStateChangeListener.MOUNTED is true but isObbMounted() is false, what is wrong? -



storage - Android - OnObbStateChangeListener.MOUNTED is true but isObbMounted() is false, what is wrong? -

i have extension file under "/sdcard/android/obb/com.example.obbtest/vid-exp1.obb". contains mp4 file , want mount .obb read file.

this i'm doing mount it:

string obbdir = "/sdcard/android/obb/com.example.obbtest/vid-exp1.obb";

.

storagemanager storage = (storagemanager) getapplicationcontext().getsystemservice(storage_service); storage.mountobb(obbdir, null, listener);

this listener code:

onobbstatechangelistener listener = new onobbstatechangelistener() { @override public void onobbstatechange(string path, int state) { if (state == onobbstatechangelistener.mounted) { toaststring("mounted! according listener"); //test isobbmounted() if (storage.isobbmounted(obbdir)) { toaststring("efectively mounted!"); } else { toaststring("not :("); } toaststring(storage.getmountedobbpath(obbdir)); } else { tuestamestring("not mounted according listener"); } } };

unfortunately output toast saying "mounted! according listener" followed "not :(". designed test because when tried getmountedobbpath(obbdir) got null string instead of path. i've made sure .obb file exists , that, without or without right encription key don'get "mounted!...".

i don't understand why onobbstatechangelistener.mounted true isobbmounted(obbdir) false. know doing wrong?

had problem on samsung device. happens when /mnt/sdcard/ not directory symlink dir (in case /storage/sdcard0).

in case storagemanager uses not path obb have specified, path symlinks resolved: isobbmounted("/mnt/sdcard/my.obb") returns false , isobbmounted("/storage/sdcard0/my.obb") true.

to access mounted obb, must not utilize path obbdir, path passed onobbstatechange() in first argument: isobbmounted(path).

android storage mount

No comments:

Post a Comment