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. Handling multiple resource trees

I am splitting my code into a common source tree witb code to share
among multiple android projects and
project specific source trees. This works well except for resources.
My development environment (intellij) has problems with
multiple resouce trees and gives strange errors when multiple res
directories are included -
Has anyone gotten this going and if so how were multiple resource
directories handled????

-- 

2. Update status via Facebook for Android

Just sharing aja, klo ada yang mau ngeracunin orang or mengeksiskan android
di facebook.. :D

Facebook for 
Android<http://www.facebook.com/connect/prompt_feed.php?api_key=7d1f437b51a0b9fd2863ff6c645a653c&session_key=2.pIne1ajWRuyndaCcMeyBAg__.3600.1268064000-811270133&attachment=%257B%2522name%2522%253Anull%252C%2522caption%2522%253A%2522%2522%252C%2522description%2522%253Anull%252C%2522href%2522%253Anull%257D&preview=1&message=update+statusmu&user_message_prompt=web+update+status&callback=http%3A%2F%2Fandroid.okykrismadi.co.cc%2Findex.php&cancel=http%3A%2F%2Fandroid.okykrismadi.co.cc%2Findex.php>

--
Sent from Red Envelope for Green Robot

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

3. Help ! Urgent

4. Upgrade os samsung Galaxy Spica GT-I5700

5. Making a clickable LinearLayout change color on click?

6. Is getInstallerPackageName the solution to piracy?

7. How to end the Application?