How to search for removable USB drive and get all content inside it?

luieyluiey Member ✭✭

I'm using VS2017 Community to build Xamarin.Forms .NET Standard app in C#. The app will be running on android device. I want to detect USB drive is mounted and get all files path inside USB which is images and video. I cannot get the idea of how to do it. I have search some of the question but I cannot make it works.

My app will be running on below setup:-

Solution from below not work OR I'm doing it the wrong way:-
https://stackoverflow.com/a/19982338/3436326
https://stackoverflow.com/a/17085125/3436326

I also try to use File[] externalStorageFiles=ContextCompat.getExternalFilesDirs(this,null); but get error on ContextCompat not exist in current context.

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    If you want to verify that if your phone is recognized by the computer, you can connect your android phone to computer by usb cable, and by command line:

     adb devices
    

    if your android device has been regonized by computer, it will show the result like this:

Sign In or Register to comment.