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:
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/
Use monitor (Android Debug Monitor) to put expansion files on your device for testing.
My experience with a Nexus 7 (not rooted) using: command line adb vs monitor (Android Debug Monitor)gui:
1) adb push main.1.com.mypackage.obb /sdcard/Android/obb/com.mypackage/main.1.com.mypackage.obb
looked successful. However the app could not find the expansion file, and a file explorer on the device could not display the file. note:the device was not rooted and I could not run adb root.
2) using the monitor gui - start from command line with: ../sdk/tools/monitor Using the monitor gui showed that the /sdcard location actually pointed to several different file links. In order for the app to see the expansion file I had to put the expansion file to the proper linked file location - in my case this was /mnt/shell/emulated/obb/com.mypackage - which adb shell still did not show, however the apps on the device could reach the file.