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. Exception when using a BroadcastReceiver for battery-change events

I want to monitor battery temperature, if available. I create a
Receiver like this:

    private BroadcastReceiver myTempReceiver = new BroadcastReceiver()
{

                @Override
                public void onReceive(Context ctx, Intent myIntent ) {
                        int temp = myIntent.getIntExtra( 
BatteryManager.EXTRA_TEMPERATURE ,
0 );
                        commonTempLogic( (float) temp );
                }


And I register it like this:

                registerReceiver(myTempReceiver, new
IntentFilter(Intent.ACTION_BATTERY_CHANGED));

When onReceive gets the first Intent, it fails with an exception:

07-07 22:10:01.186: ERROR/AndroidRuntime(777):
java.lang.RuntimeException: Error receiving broadcast Intent
{ act=android.intent.action.BATTERY_CHANGED flg=0x40000000 (has
extras) } in com.shipmate.sensorservic...@43d1b250

Any idea why this might be happening?

-- 

2. Android IMEI with letter :O

Hi all,

after this code:

TelephonyManager mTelephonyMgr = (TelephonyManager)
getSystemService(Context.TELEPHONY_SERVICE);
pin = mTelephonyMgr.getDeviceId();

the pin variable should contain the IMEI number of the phone,
on some phones it returns LETTER and DECIMAL, how it it possible?

IMEI with letter? :o

-- 

3. Flipping Button Text Vertically

4. How to realize TextView control has wordwrap functionallity.

5. develop an application windows - android

6. How to overcome Android WebView file size limit when loading a file

7. problem with my browser