FileDocCategorySizeDatePackage
SdCardIntentReceiver.javaAPI DocAndroid 1.5 API2593Wed May 06 22:42:48 BST 2009com.android.settings

SdCardIntentReceiver

public class SdCardIntentReceiver extends android.content.BroadcastReceiver

Fields Summary
private static final int
SDCARD_STATUS
private static final String
TAG
Constructors Summary
Methods Summary
public voidonReceive(android.content.Context context, android.content.Intent intent)


    
          
        NotificationManager nm = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        String action = intent.getAction();
        if (Config.LOGD) Log.d(TAG, "onReceiveIntent " + action);

        if (action.equals(Intent.ACTION_MEDIA_MOUNTED)) {
            nm.cancel(SDCARD_STATUS);

            Intent statusIntent = new Intent(Intent.ACTION_MAIN, null);
            statusIntent.setClass(context, SdCardSettings.class);
            nm.notify(SDCARD_STATUS, new Notification(context,
                    android.R.drawable.stat_notify_sdcard,
                    null,
                    System.currentTimeMillis(),
                    context.getText(R.string.sdcard_setting),
                    null,
                    statusIntent));
        } else if (action.equals(Intent.ACTION_MEDIA_REMOVED)) {
            nm.cancel(SDCARD_STATUS);
        } else if (action.equals(Intent.ACTION_MEDIA_SHARED)) {
            nm.cancel(SDCARD_STATUS);

            Intent statusIntent = new Intent(Intent.ACTION_MAIN, null);
            statusIntent.setClass(context, SdCardSettings.class);
            nm.notify(SDCARD_STATUS, new Notification(context,
                    android.R.drawable.stat_notify_sdcard_usb,
                    null,
                    System.currentTimeMillis(),
                    "SD Card",
                    null,
                    statusIntent));
        }