且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Android SD卡Delphi中索引已创建的文件

更新时间:2022-03-11 01:35:02

在Windows资源管理器中无法立即看到新创建的文件的原因不在于您的代码,而是在于MTP协议的工作方式.

The cause for newly created files not being imediately visible in Windows Explorer does not lie in your code but in the way how MTP protocol works.

您会看到,当您使用MTP协议将android设备连接到计算机时,设备本身会在计算机需要时向计算机提供文件列表,但它不支持实时更新或文件更改通知.

You see when you conect your android device to your computer using MTP protocol the device itself does provide your computer with list of files on it when your computer demands it but it does not support live update or noficiation of file changes.

从技术上来讲,唯一可让您的计算机收到有关Andoid设备上文件更改的通知的协议是USB大容量存储.但是此协议有局限性,要求您的计算机具有对文件存储的独占访问权限,这将阻止您的android设备上的任何程序在USB大容量存储连接处于活动状态时对这些文件进行任何更改.

The only protocol that would technically allow your computer to be notified of file changes on your andoid device is USB mass sotrage. But this protocol has limitation which requires that your computer gets exclusive access to file storage which would then prevent any program on your android device to make any cahnges to theese files while USB mass storage conection is active.

您可以在此处详细了解android使用的不同连接协议:

You can read a bit more about different connection protocols that android uses here:

Android USB解释的连接:MTP,PTP和USB海量存储