Android detect usb storage for kitkat (4.4)

Please post code for your BroadcastReceiver and AndroidManifest.xml.

Manifest should look something like

<application>
    <!--- ... --->
    <receiver android:name=".UsbBroadcastReceiver"
            android:exported="true"
            android:enabled="true" >
        <intent-filter>
            <action android:name="android.intent.action.MEDIA_MOUNTED" />
            <action android:name="android.intent.action.MEDIA_UNMOUNTED" />
            <data android:scheme="file" />
        </intent-filter>
    </receiver>
</application>

Note the data tag, it's often overlooked.

In your onReceive implementation the URI to root of mount can be obtained from Intent#getData().

Also note that this will not work on Android 6.0 (M) and above. For 6.0 and above your code must request access to USB via one of two ways:

1) UsbManager#requestPermission

2) Intent#ACTION_OPEN_DOCUMENT_TREE as part of Storage Access Framework