how to emulate a real external sd (update: removab

2019-05-07 06:41发布

问题:

I try to emulate a external sdcard as it would be in a real device.

In a real device the external sdcard is not writeable except you use the new "Storage Access Framework" (API 21 & 22)

When I add an sdcard either with a file or Size ...

I always get a writeable sdcard, which is not true with a real device (I guess). I could create the Folder "CreateFolder" with just ( I know, I should not use the direct access, but this is only for a test to see if I have write access):

        String spathWriteTest="/storage/sdcard/";
        new File(spathWriteTest + "createFolder").mkdir();

Any Idea, howto emulate a real external sdcard ?

回答1:

When you set up an AVD, and it refers to an "SD card", it is really referring to external storage, not removable storage. The emulator does not emulate removable storage. You could see if Genymotion emulates removable storage.