Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android lollipop create a folder in USB OTG

Unable to create a folder in USB storage using this method:

File dest = new File("storage/usbotg/NewFolder");
dest.mkdirs();

the same method working fine in device storage

File dest = new File(Environment.getExternalStorageDirectory() + "/NewFolder");
dest.mkdirs();

but not in usb storage , any suggestion?

The device is Lenovo TAB2 A10-30.

like image 861
Mohammad abumazen Avatar asked Oct 15 '25 17:10

Mohammad abumazen


1 Answers

This Solution for rooted devices only edit plattform.xml file in /system/etc/permissions

from

<permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
    <group gid="sdcard_r" />
    <group gid="sdcard_rw" />
</permission>

to

<permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
    <group gid="sdcard_r" />
    <group gid="sdcard_rw" />
    <group gid="media_rw" />
</permission>

Save the file then reboot , this is a solution for SDCard also.

like image 139
Mohammad abumazen Avatar answered Oct 18 '25 18:10

Mohammad abumazen