Hi Joseph
I hope it help you. Example for review the status from SD Card
if (android.os.Environment.MEDIA_MOUNTED.equals("mounted"))
{
}
else if (android.os.Environment.MEDIA_MOUNTED.equals("unmounted"))
{
}
else if (android.os.Environment.MEDIA_MOUNTED.equals("shared"))
{
}
And this code for alert in the moment
mReceiver1 = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
//Toast.makeText(context,
context.toString(),Toast.LENGTH_LONG).show();
String action = intent.getAction();
if (action.equals(Intent.ACTION_MEDIA_MOUNTED)) {
Toast.makeText(context, "SD Card
mounted",Toast.LENGTH_LONG).show();
} else if (action.equals(Intent.ACTION_MEDIA_UNMOUNTED)) {
Toast.makeText(context, "SD Card
unmounted",Toast.LENGTH_LONG).show();
} else if (action.equals(Intent.ACTION_MEDIA_SCANNER_STARTED)) {
Toast.makeText(context, "SD Card scanner
started",Toast.LENGTH_LONG).show();
} else if (action.equals(Intent.ACTION_MEDIA_SCANNER_FINISHED)) {
Toast.makeText(context, "SD Card scanner
finished",Toast.LENGTH_LONG).show();
} else if (action.equals(Intent.ACTION_MEDIA_EJECT)) {
Toast.makeText(context, "SD Card eject",Toast.LENGTH_LONG).show();
} else if(action.equals(Intent.ACTION_UMS_CONNECTED))
{
Toast.makeText(context, "connected",Toast.LENGTH_LONG).show();
} else if(action.equals(Intent.ACTION_UMS_DISCONNECTED)) {
Toast.makeText(context, "disconnected",Toast.LENGTH_LONG).show();
}
}
};
registerReceiver(mReceiver1, intentFilter1);
Regards
David
2010/7/24 Joseph Earl <[email protected]>
> Cheers
>
> On Jul 24, 11:25 pm, Streets Of Boston <[email protected]>
> wrote:
> > Search for "ACTION_MEDIA_EJECT" on this forum.
> >
> > On Jul 24, 1:02 pm, Joseph Earl <[email protected]> wrote:
> >
> > > I would like my Activity to be informed when the SD card is removed,
> > > since it relies on files from the SD card (to keep apk size down) but
> > > for compatibility reasons is not targeted at Froyo.
> >
> > > I'd like to close the application when the SD card is removed/mounted
> > > (giving the user a dialog message to inform them of course) so that I
> > > don't get IOExceptions etc (I'd quite like to not have to check
> > > everytime I load a file to see if the external storage is available, I
> > > already do a check on application launch).
> >
> > > There doesn't seem to be any attribute in the manifest for this (like
> > > configChanges) that I can find.
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
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