1

I am developing an app in java in which i have to excess my window phone drive. I want to be able to read and write on window phone through my java program.

Problem:

My problem is , i cannot find the path to my window phone device on windows. window is not assigning any drive letter to phone drive, rather than this , window is showing the path something like (Computer\Windows Phone\Phone\Videos).

And when i use that path in my java program then file not found exception is raised which means that i cannot excess that folder (Videos) using that path (Computer\Windows Phone\Phone\Videos) .

i have visited the following links

Portable Device Path on Windows Getting Portable Devices using java

Both links did not work for me. Obviously there are some libraries like libmtp , jmtp and jusbpmp out there but all these are buggy, and i do not want to use these libraries.

My question is that how can i get the path to the window phone drive using which i can read and write on window phone in java..... ?

Is there any way to assign Window fone a drive letter so that my java can locate that drive ? I have tried to get that path from registory and device manager also but in vain. I also tried to read Win32_USBHub database but that also didn't bring the solution. Guide me to right direction. Thanks

Community
  • 1
  • 1
Ahsan
  • 87
  • 1
  • 10

1 Answers1

0

I know of a project that allows access using MTP http://code.google.com/p/jmtp/

        // Iterate over files
        for (PortableDeviceObject pdo : device.getRootObjects()) {
            // If the object is a storage object
            if (pdo instanceof PortableDeviceStorageObject) {
                PortableDeviceStorageObject pds = (PortableDeviceStorageObject) pds;

                for (PortableDeviceObject childPdo : pds.getChildObjects()) {              

                    System.out.println(childPdo.getOriginalFileName());
                }
            }
        }
Abs
  • 3,902
  • 1
  • 31
  • 30
  • JetAbe , is not there any way without using any library ? – Ahsan Jun 02 '14 at 08:24
  • childPdo.getOriginalFileName just returns the sub directory name only. i need a full path to that directory. so that i will be able to access that directory from my java program. – Ahsan Jun 02 '14 at 08:34
  • It return file name only, is there any way to read that file or get file object to make it's copy? – Dinesh Falwadiya Aug 27 '18 at 05:04