4

I would like to write a program in java that copies mp3 files from my PC, renames them so they sort correctly, and transfers them to the sdCard on my Android phone via USB. I assumed this would be a trivial task since I have already successfully written a similar program for transferring files to an external HDD, however I reached an immediate stumbling block. It seems that java (and indeed other desktop applications) cannot locate the device's file system even when given the exact path that windows explorer reports (This PC\SAMSUNG-SM-G900V\Card).

I've tried researching and the problem seems to have to do with the device being considered a Portable Device rather than a drive (maybe) but I have not found a concrete solution. An answer to the following question seems to suggest it is impossible but I find that hard to believe.

Can Android's internal memory be mapped to a drive letter on PC?

Does anyone know of a way to access Portable Device storage through java? If if it indeed impossible, can someone perhaps help me understand why it is possible through Windows Explorer but not through other programs.

Cœur
  • 37,241
  • 25
  • 195
  • 267
G-Cam
  • 261
  • 3
  • 12
  • Hmm, good question. Isn't there a way to map mobile devices to Windows so they are recognized as a drive, and not a device? I'm wondering if it's just a case of Windows needing to know it is, in fact, an acceptable drive to write to. Like usually on a device you can explicitly say "map as drive." – NoChinDeluxe Feb 01 '16 at 21:56
  • One way to do this would be to just have the Java program call out to adb to do an adb push. Since this seems like a personal app rather than something you're trying to make scale to other people it would probably be enough. – Gabe Sechan Feb 01 '16 at 21:58
  • I appreciate the comments. In case anyone stumbles across this question, I wound up using a rather ridiculous workaround in which I removed the microSD card and connected it directly to my computer. It was trivial to programmatically transfer and modify data at that point. – G-Cam Feb 08 '16 at 14:02

0 Answers0