0
我想通过Java来访问我的智能手机(三星Galaxy S4),就像任何其他的USB驱动器,但它并没有在驱动器列表中显示出来:检测移动设备的Java
File[] f = File.listRoots();
for (int i = 0; i < f.length; i++) {
String drive = f[i].getPath();
System.out.println("Drive: " + drive);
}
的Windows似乎将其归类为移动设备。 有没有像其他驱动器一样检测它的简单方法?
据我所知,Windows通常将Galaxy S4视为MTP设备。 S4的USB选项还可让您将其配置为PTP设备。对于MTP,http://stackoverflow.com/questions/33947921/best-method-for-copying-file-from-mtp-device-to-pc可能会有帮助(虽然它明显链接到的jMTP库尚未年)。对于PTP,http://stackoverflow.com/questions/6498179/java-list-cameras-that-are-plugged-in可能工作。无论您选择什么,我都不认为这会很容易或干净。 – VGR