0

I want to access my smartphone (samsung galaxy s4) via Java just like any other USB-drive but it does not show up in the list of drives:

File[] f = File.listRoots();
for (int i = 0; i < f.length; i++) {
    String drive = f[i].getPath();
    System.out.println("Drive: " + drive);
}

Windows seems to classify it as an mobile device. Is there a simple way to detect it just like any other drive?

Pixelbrei
  • 23
  • 5
  • As far as I can tell, Windows normally sees the Galaxy S4 as an MTP device. The S4’s USB options also let you configure it to be seen as a PTP device. For MTP, http://stackoverflow.com/questions/33947921/best-method-for-copying-file-from-mtp-device-to-pc may help (though the jMTP library to which it links apparently hasn’t been touched in years). For PTP, http://stackoverflow.com/questions/6498179/java-list-cameras-that-are-plugged-in may work. Whatever you choose, I don’t think it will be easy or clean… – VGR Jul 15 '16 at 21:35

1 Answers1

1

In the end I used jMTPe to access my phone on windows and it works very well. Although it's only compatible with a 32bit JRE.

Pixelbrei
  • 23
  • 5