开发者

How to make a simulated SD card (an image) work together with a real one in Android 2.2?

开发者 https://www.devze.com 2023-02-05 19:27 出处:网络
I\'ve managed to simulate a fake sdcard on Android 2.2, so that when I don\'t have a real sdcard, applications that need sdcard will still work. To achieve this, I borrowed some code from the Andr开发

I've managed to simulate a fake sdcard on Android 2.2, so that when I don't have a real sdcard, applications that need sdcard will still work. To achieve this, I borrowed some code from the Andr开发者_开发百科oid-x86 project's extended version of `vold', and did the following:

# dd if=/dev/zero of=/data/sdcard.img bs=1024 count=1 seek=1000000 (1GB image, a sparse file)
# busybox losetup /dev/block/loop7 /data/sdcard.img
# newfs_msdos /dev/block/loop7

The problem is, when a real sdcard is inserted, I wish to use both of them without switching back and forth between them - namely, a `dual sdcard setup' on a system which only allows one sdcard. How can this be achieved?


Personally I'm not quite familiar with the Android system (actually today is my second day working on an Android project). I was told that the 2.2 version only supports one sdcard mounted on "/mnt/sdcard", applications that read/write sdcard will follow this path. I'm not quite sure about this. Can someone please shed me some light on the Android sdcard limitations and how its presence affects applications?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号