sd card storage state and detecting it being plugged in or not...

by sdphil » Sat, 16 Jan 2010 09:41:17 GMT


Sponsored Links
 i have an app that needs to be able to write to the sdcard.

so, it goes without saying that I need to be able to detect if the
sdcard is being shared or not -- simple enough.
    android.os.Environment.getExternalStorageState().equals
(android.os.Environment.MEDIA_SHARED)

if this is true, then my app does not have access to the SD card -
perfect.

I would also like to know while my app is running, if the state of the
SD card changes.  It looks like I can create a BroadcastReceiver with
an IntentFilter that traps the event.

the problem is that that the system winds up killing my process
because it has a file open on the SD card.

01-15 17:33:44.091: ERROR/vold(47): KillProcessesWithOpenFiles /sdcard
01-15 17:33:44.322: ERROR/vold(47): process com.test.test (7351) has
open file /sdcard/test/logfile.txt

how can I prevent this?

tia.



Other Threads

1. OOT: Ada yang ke ICS kah hari ini?

Ada yang ke ICS ga hari ini? Kebetulan mau kesana pas jam makan siang.
motodroiddoes

Lalika Wedding Portraiture
http://bit.ly/9Gx5vO (facebook)
http://bit.ly/di7Ipu (weddingku.com)
contact.lal...@gmail.com

-- 
"Indonesian Android Community [id-android]" 

2. Porting Android to omap 3530

Hi All,
Please if this not the right forum for this question let me know where
to go.

I am trying to port Android to omap 3530. The system is booting to
Linux 2.6.20-rc3 plus some patches from TI. I am trying to find
appropriate kenrel patches to patch the OS.

Many thanks in advance,

Mehrsa

-- 

3. Launching

4. Nubi tanya logout di X10 Mini Pro

5. Voice Input and Hard Keyboard

6. Mod: List Peserta Gathering ID Android ke 6, Sabtu 17 Juli 2010

7. Mencoba Acer Android Liquid E [Acer Smart Handheld "Liquid" Competition]