How to mount SD as USB mass storage automatically

by telematics » Fri, 06 Mar 2009 05:13:54 GMT


Sponsored Links
 I am developing an android app that will automatically mount the SD as
the USB mass storage when the G1 phone is connected to a PC via USB,
and automatically umount it when the USB is disconnected. I know to
how to create a broadcast receiver to receive  UMS_CONNECTED and
UMS_DISCONNECTED broadcast intents, but I don't know whic API I should
use to mount/umount the SD. Is there anyone can help me on this?

Thank you in advance.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. FLAG_ONEWAY for asynchronous communication between services

Hi,

for research reasons I want to study the possibility for asynchronous
communication between services in Android. Currently I'm using the
FLAG_ONEWAY option in the AIDL interface of the services. What I see
is that the asynchronous commmunication works fine when the services
are implemented in different APKs.

If the services are implemented in the same APK, they communicate
synchronous although I have defined them with the attribute
android:process=":remote" and I've used the FLAG_ONEWAY option.

Can anybody explain me why that happens? Is it possible for two
services to communicate asynchronously with each other through AIDL
interfaces using the FLAG_ONEWAY option?

Best wishes,
Vladimir

--~--~---------~--~----~------------~-------~--~----~

2. Screen orientation woes

Hi all,

For my app the landscape orientation is useless, so I set my
activity's "Screen orientation" attribute to "portrait". Even when the
screen orientation changes to landscape, whatever I draw is simply
drawn flipped 90 degrees, which is what I want.

I also don't want my activity to get restarted when the screen
orientation changes, so I set the "Config changes" attribute to
"mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|fontScale"
and handle onConfigurationChanged myself. That's great too.

Now, the thing is, that when onConfigurationChanged gets called, the
orientation is always reported as portrait, while I really want to
know that the user has changed it to landscape, so I can put a message
saying something like "landscape orientation is not supported".

Is there a way to do that? Is there a way in which I can query the
device for it's physical orientation?

On a side note, I read here[1] that I can set the orientation to
"sensor", which will report screen orientation changes as the device's
physical orientation changes. Does this really work on a real device
(I still don't have one) or that's reserved for a future release? I'm
asking because from what I read in some G1 reviews, the device's
screen orientation changes to landscape only when the user slides the
keyboard open.

FWIW I'm using SDK 1.0 r1.

Thanks,
Stoyan

[1] 
http://code.google.com/android/reference/android/R.styleable.html#AndroidManifestActivity_screenOrientation

--~--~---------~--~----~------------~-------~--~----~

3. How to automate emulator hardware keys.

4. SpecialCharacters

5. WindowManager$BadTokenException: Unable to add window -- token null is not for an application

6. problems with MapActivity in 1.0_r1 eclipse 3.3.2

7. Keeping ListView rows clickable