Code example for StorageManager

Methods: isUsbMassStorageConnected

0
 
    public StorageNotification(Context context) {
        mContext = context;
 
        mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
        final boolean connected = mStorageManager.isUsbMassStorageConnected();
        if (DEBUG) Slog.d(TAG, String.format( "Startup with UMS connection %s (media state %s)",
                mUmsAvailable, Environment.getExternalStorageState()));
         
        HandlerThread thr = new HandlerThread("SystemUI StorageNotification");
        thr.start();
        mAsyncEventHandler = new Handler(thr.getLooper());
 
        onUsbMassStorageConnectionChanged(connected);
    } 
 
    /* 
     * @override com.android.os.storage.StorageEventListener 
     */ 
    @Override 
Contextual code suggestions in your IDE  Get Codota for Java