my quetion is from switching "usb connected" in the phone
notifications,which pop up from taskbar.
try to all the ACTION_MEDIA_* series of Intent actions,but these are
all failed.these actions couldn't real-time monitor the state of SD
card.
also, use broadcast receivers,the code like this, but it's still not
dynamic mounted or unmounted:
        @Override
        public void onResume()
        {
             super.onResume();

             IntentFilter filter = new IntentFilter();
             filter.addAction(Intent.ACTION_UMS_CONNECTED);//try all the
other ACTION_MEDIA_* series of Intent actions,and these are also
unsuccessed.
             registerReceiver( mBroadcastReceiver, filter );
        }

        @Override
        public void onPause()
        {
              super.onPause();

              unregisterReceiver( mBroadcastReceiver  );
        }

        private BroadcastReceiver mBroadcastReceiver  = new BroadcastReceiver
()
        {
             @Override
             public void onReceive(Context context, Intent intent)
            {
                  updateSDcardStatus();
            }
        };

        private void updateSDcardStatus()
        {
             Log.i(TAG, "other status: " + status );
        }
can you give me a demo,and you can success to mount the state of SD
card

On Sep 10, 1:07 am, Mark Murphy <[email protected]> wrote:
> jerry wrote:
> > I want to know the state of SD card is dynamic mounted or not mounted?
> > it's very kind of you if you can give me a demo(for example, use api
> > registerReceiver、BroadcastReceiver、onReceive and so on).
>
> Look at the ACTION_MEDIA_* series of Intent actions:
>
> http://developer.android.com/intl/zh-CN/reference/android/content/Int...
>
> For examples of using broadcast receivers, both those registered in the
> manifest or those using registerReceiver(), I have some examples from my
> Advanced Android book up on github:
>
> http://github.com/commonsguy/cw-advandroid/tree/e50e087577f8b28e72735...
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android App Developer Training:http://commonsware.com/training.html
--~--~---------~--~----~------------~-------~--~----~
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