title: How does android know to start indexing a new media file?
body: <p>It seems that when I put an SD card in my phone with some music, Google Play music suddenly knows about it. Or if I copy more music to the card, Google play hears about it.</p>
  
  <p>I've now purchased a device (Nexus 5) without an SD card slot, but with OTG capability. It seems that just plugging in a USB drive, does not get the built in music app to index it, so I'm trying to write my own.</p>
  
  <p>Where should I start to write a listener, that hears when the USB OTG drive is connected, so I can index the content in my music playing app ? How can I determine the location of the OTG drive (e.g.: /mnt/usbdisk0 etc?) Is there an API to determine this for all devices ?</p>
  
  <p>EDIT: To further clarify, I build AOSP from source (6.0) and installed it on my nexus 5, so the built-in music player is NOT Google Play music, but just the android open source music app. This app does not detect or index the music from the OTG, and I am trying to modify it so that it sees it. If I go to Android's settings app, I can see that it has detected the OTG drive, and I can "explore" it, and play individual files by navigating to the directory where I have stored the music files. But the music app does not index this.</p>