I have an Android 6.0 phone with internal memory, removable SD card and USB OTG (pen-drive with micro USB jack) inserted in the phone. Removable SD card and USB OTG was ejected in Android equipment: "Settings" -> "Storage & USB". I can mount removable SD card and USB OTG in this equipment. For example, I mount removable SD and want to differentiate this event from mounting of USB OTG. The only action I can get in the receiver
<receiver
android:name=".receiver.RemovableMediaReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MEDIA_MOUNTED"/>
<action android:name="android.intent.action.MEDIA_UNMOUNTED"/>
<action android:name="android.intent.action.MEDIA_EJECT"/>
<action android:name="android.intent.action.MEDIA_BAD_REMOVAL"/>
<data android:scheme="file"/>
</intent-filter>
</receiver>
on mount is android.intent.action.MEDIA_MOUNTED and path to root of mounted SD card as an extra to this action - /storage/A13D-EF43. The same situation is for USB OTG mounting event. The only difference is in the name of mounted USB OTG - path is /storage/BD76-24ED.
How can I understand which media was mounted - SD or USB OTG - if I have no API call to get a name of SD or USB OTG before mounting in order to compare it with extra (path) from android.intent.action.MEDIA_MOUNTED?