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. Apps not showing up on Droid Eris (running cupcake)??

I have the "min SDK version" set to 3 in the manifest.  Shouldn't the
apps still be available in the Cupcake Market?  Anyone know why apps
are not showing up there?  Or better yet, how to make them reappear?

Thanks!

Steve

-- 

2. high loadavergae and cpu in power save mode ?

The actual power consumption of the device should lower if you do not
hold the wakelock, what you call (power save mode).

The reason why you see a sudden spike in the /proc/cpuload is because
when you wake up the device  the cpuload timers are queued up so
CALC_LOAD is called muitple times for the sleep duration but it
calculates this with the current # of active tasks (when the device
wakes up) which skews the results. What you really want is to
calculate the load with number of active tasks for just 1 of the ticks
not all of them.

Its an error in now the kernel calculates load but shouldn't impact power.

Hope you are enjoying your Android phone :)

-- Mike





> website: 

3. Problem with HttpURLConnection

4. onClickListener for tabs in TabActivity

5. comments on the 'Integrating Application with Intents" blog

6. Passing a Hashtable in Intent Extras..

7. Toggle state button