Search code examples
androidfile-writingusb-drive

How to write the data to USB stick(Pendrive) from the application in android


In my application i have to write the Data to USB stick(Pendrive) from the application.

My application will support to write the data to Local memory and USB stick(Pendrive).

Currently i am able to write the data to Local memory ,but i am unable to write to USB stick(Pendrive).

Do we need to add any extra permission other than WRITE_EXTERNAL_STORAGE?

Is writing to USB stick(Pendrive) through app possible?

I am able to ready the files which are there in the USB,i am not able to write the data.

Here is the folder path where i want to write the data. "/storage/usb1/TestFolder"

Can i get some help on this?


Solution

  • In order to write some data to USB, we need

    uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE"
    

    By referring some links i got to know that the above permission can get by Provider of the device.

    So we can apply above mechanism to get it done.