Android: how to read files in Java application from MTP

I need to be able to read the phone's file system from a Java desktop application. I don't want to use adb.

Older Android devices / versions had Usb Mass Storage, but all newer devices do not have this option.

So can someone help with the library and sample code ... What I need: 1) Reading files (actual file and file properties including paths - I only need to get .mp3s) 2) Writing to specific locations

Thank!

+3


source to share


1 answer


I tried to read data from MTP using jusbpmp library, but the following example code returned me an empty array of devices, even though I had my Android phone connected in MTP working mode:



dm = DeviceManager.getInstance();
dm.createInstance();
dm.scanDevices();
dm.dump();

      

+1


source







All Articles