Code example for StorageManager

Methods: isUsbMassStorageConnected

    public StorageNotification(Context context) {
        mContext = context;
        mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
        mUmsAvailable = mStorageManager.isUsbMassStorageConnected();
        Slog.d(TAG, String.format( "Startup with UMS connection %s (media state %s)", mUmsAvailable,
     * @override 
    public void onUsbMassStorageConnectionChanged(boolean connected) {
        mUmsAvailable = connected;
         * Even though we may have a UMS host connected, we the SD card 
         * may not be in a state for export. 
Contextual code suggestions in your IDE  Get Codota for Java