Hi Boardy,

I have my doubts that you will get it working in a portable way across
different mobiles.
The usb implementation will be to different. The newer phones will
provide additional
and complex usb mode ( multiple cdc+acm+ adb + ?, mtp , pictbridge ),
some will change
the usbmode on the fly ( load a driver from a automounted cdrom image
on the phone and switch
after installation in a complex usb mode ) .. and for this the
different manufacturers will adapt the kernel
to framework communication and add components to the framework.

In principle the new froyo vold listens  for a sysfs file "/sys/
devices/virtual/switch/usb_mass_storage/state" .
If their is the state "online" , then  the VolumeManager will send a
BroadCast-Message which is IMHO propagated
via the ServiceManager to the rest of the framework and the
MountService. The MountService will send a Notification which you
could catch .

Good luck !

  Frank

On 6 Nov., 21:30, Boardy <[email protected]> wrote:
> Hi all,
>
> I am currently looking into developing an application for the android
> platform. I was wondering if there was a way in order to perform an
> action when the phone is connected via usb. I want it to perform an
> action depending on the connection state, i.e. do action A if not
> connected to PC, do action B if connected to USB in charge mode, do
> action C if connected via USB Disk etc.
>
> Is this possible.
>
> Thank for your help

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to