I'm developping the obb integration for the "expansion files". I made it worked in local by copying the .obb file on the sdcard of the device (4.1) but on my 4.2 devices it is not working anymore.
1) On 4.1 tablet: it's working well. I pushed my extension pack file using an adb command on a tablet and then I'm able to find the file and read it :
adb push main.1.mypackage.obb /sdcard/Android/obb/mypackage/
shell@android:/sdcard/Android/obb/mypackage/ $ ls -al
-rw-rw-r-- root sdcard_rw 20314171 2013-08-05 18:01 main.1.mypackage.obb
2) On 4.2 : the same procedure as above, the file is not "visible", both exists() and canRead() methods on the main activity return false.
adb push main.1.mypackage.obb /sdcard/Android/obb/mypackage/
shell@android:/sdcard/Android/obb/mypackage/ $ ls -al
-rw-rw-r-- root sdcard_rw 20314171 2013-08-05 18:54 main.1.mypackage.obb
Solution : From there, I investigated using the app "Android File Transfer" and I found that the obb folder is empty from the tool… so it is not the same folders I push the data into…
I uploaded the .obb using the app "Android File Transfer" and then it is working… But in that case I don't know where the file are stored (not on the sdcard, I guess ??)
So guys, what I need to change on 4.2 for accessing my .obb file? Thanks in advance
Extra informations:
a) I made a basic test to check the file existance using "file.exists() + " canRead=" + file.canRead()" with Environment.getExternalStorageDirectory :
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()
+ "/Android/obb/packagename/main.1.packagename.obb");
b) The procedure is scripted so the issue is not coming from a manual mistake (and triple check everythings)
EDIT
c) To sum up :
With "adb push" on 4.2 it is working for "normal" data: If I put a folder with images in /sdcard/myfolder/ it is working but not below /sdcard/android/.
The Android File Transfer shows a "Android/obb" folder at the root and .obb files are visible from the code in that case but:
- I cannot confirm it is on the /sdcard from the 'Android File Transfer App', what is disturbing me is that doing an "adb shell ls /sdcard/Android/obb" display that the folder is empty…
- I cannot use the same script for 4.1 and 4.2, validate the production procedure and use it in dev to save a lot of time with a light apk (and save time on build & deployment time)…
SOLUTION USED INTERNALLY
For < 4.1
adb push main.1.mypackage.obb /sdcard/Android/obb/mypackage/
For >= 4.2
adb push main.1.mypackage.obb /mnt/shell/emulated/obb/mypackage/