mtp

How to construct path for mtp devices (usable in folder browse dialog)?

烂漫一生 提交于 2021-01-04 06:41:50
问题 I implemented file transfer from windows pc to an android device, which is connected with MTP to the computer. The copy implementation is ready (I used this example: http://code.msdn.microsoft.com/windowsdesktop/Portable-Devices-COM-API-fd4a5f7d). Now I would like to improve UI, I would like to offer a folder selection dialog, where the user can select a MTP device folder, where I will save the file (CLSID_FileOpenDialog with FOS_PICKFOLDERS works nice). Note that simple file save dialog

access mtp device with java

旧街凉风 提交于 2021-01-02 05:33:11
问题 I have developed a small application that copies files from a folder to another.I use a JFileChooser to select the target directory.Something I hadn't tried for a long time is to select my phone as the target directory.I tried but I couldn't find it from my JFileChooser. I read some other so questions and I was wondering if there is that will allow me to copy files from my pc to an mtp device? I am targeting linux and windows platforms. My phone is LG Nexus 5 android 6.0.1. Thanks for your

Access MTP storage with System.IO from PowerShell

ε祈祈猫儿з 提交于 2020-01-02 04:34:16
问题 I'm trying to access MTP device storage to automate file copy, backup, etc. If Windows Explorer is able to open and browse Android device Internal Storage and connected SD card, how can I access these storages with PowerShell? I've found a lots of hints, such as "get device ID and use WMI" What is the way the Windows Explorer uses to open and browse especialy Android's storages? Is it possible to use some System.IO Class like here? $drives = [System.IO.DriveInfo]::GetDrives() $r = $drives |

Issues traversing through directory hierarchy with Android Storage Access Framework / DocumentProvider using MTP

核能气质少年 提交于 2019-12-20 04:54:09
问题 UPDATE: My initial question may be misleading so I want to rephrase it: I want to traverse through the hierarchy tree from an MTP connected device through Android's Storage Access Framework. I can't seem to achieve this because I get a SecurityException stating that a subnode is not a descendant of its parent node. Is there a way to workaround this issue? Or is this a known issue? Thanks. I'm writing an Android application that attempts to traverse and access documents through the hierarchy

Android: How to detect a change in MediaStore when connected over MTP

给你一囗甜甜゛ 提交于 2019-12-17 18:11:06
问题 I have big problems with MediaStore. I need to handle events when MediaStore is changed over MTP. I already have a receiver for android.intent.action.MEDIA_SCANNER_FINISHED action, but it is useful only for Universal Mass Storage(UMS). The scanner is not launched over MTP, because the MTP changes the MediaStore database directly. Please would you be so kind and help me how to detect this events. Thank you very much for any help! 回答1: I finally found a solution. I tried to use FileObserver but

Can't access stored files in public folder in Android (MTP)

不打扰是莪最后的温柔 提交于 2019-12-13 05:48:51
问题 I want to save a simple .txt file in Android and later I want to copy this file from the device to a PC where the device is mounted as a MTP-Device. I own two Android Devices: Nexus 4, Stock Android 5.0.1 Nexus 7 2012, CyanogenMod 12, Android 5.0.2 To make sure that it's not a Nexus device bug I tried a Wiko phone from a friend. I use this code to save the file to the Downloads folder on the external storage. This is recommended on the developer page. private void saveData() { String fileName

WPD MTP stream hangs on commit

我的梦境 提交于 2019-12-12 01:54:17
问题 I am using the following code to copy a file wrapped by a FileInfo object to an MTP device using the Windows Portable Device API: public static void CopyFileToDevice(PortableDeviceFolder parent, string name, FileInfo file) { IPortableDeviceValues values = GetRequiredPropertiesForContentType(parent.Id, name, file.Length); PortableDeviceApiLib.IStream tempStream; uint blockSize = 0; parent.Device.Content.CreateObjectWithPropertiesAndData( values, out tempStream, ref blockSize, null); System

Accessing MTP vendor extended properties through WPD

做~自己de王妃 提交于 2019-12-12 01:15:10
问题 I am using Windows Portable Device API to access some MTP devices. I want to read the vendor extended properties from the device, it should look something like this: "microsoft.com/WPDNA" or "microsoft.com/MTPZ" It seems like this should be a quite simple task but I cannot figure it out. I have been able to enumerate objects on a device and transfer files and so on, this was included in the WpdApiSample Application. I also found this article that I think is what I want to do. But I don't

Libmtp in windows (msys/mingw): Run problems

邮差的信 提交于 2019-12-11 16:15:37
问题 Hi i need a windows port of libmtp (github_link). So i compiled libmtp under Msys/MingW Environment. The build is successful and i have no error on build, but in runtime i have error. When function (LIBMTP_Get_Connecte_Devices) is called, the return value of this function is (LIBMTP_ERROR_CONNECTING). LIBMTP_mtpdevice_t* device_list; LIBMTP_error_number_t x = LIBMTP_GET_CONNECTED_Device(&device_list); // x = LIBMTP_ERROR_CONNECTING Can anyone can solve my problem? In addition, where can i

Copy Files/Folder to Clipboard, to allow Manual Pasting to Android through Windows Explorer (via MTP)

坚强是说给别人听的谎言 提交于 2019-12-11 15:33:17
问题 Ideally in Java, but perhaps in C#, I'm looking to programmatically copy a directory of files & folders into the clipboard, and allow the user to manually paste these through Windows Explorer (Ctr+V etc) onto their Android device, via Windows Explorer. So the code below is from the following question and is what I've tried so far:- https://stackoverflow.com/a/31798747/6120066 import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.ClipboardOwner; import