Android的文件传输无法看到应用程序创建的文件夹 [英] Android File Transfer cannot see a folder created by app
问题描述
我已经安装在Mac上的Android文件传输。 我的应用程序创建一个文件夹并创建它的文件(在AndroidManifest.xml中存在的权限),写一些数据到这个文件。 文件存在,我可以使用标准的文件管理器的Android设备访问它。它显示了多个文件夹,包括我的文件夹中,我甚至可以看到在设备上我的文件的内容。
但问题是,Android文件传输显示我的所有其他文件夹,但不是我的文件夹,我的文件。我甚至尝试创建只是一个单一的文件,而不是一个目录。同样的结果。
拔出设备或重新推出的Android文件传输没有帮助。
也许Android文件传输坏的工具?
也许Android文件传输坏的工具?
没有。
在Android 3.0+,你需要有你的文件被媒体扫描仪被索引之前,这将是在MTP到Mac可见。该<一href="http://developer.android.com/reference/android/media/MediaScannerConnection.html#scanFile%28android.content.Context,%20java.lang.String%5B%5D,%20java.lang.String%5B%5D,%20android.media.MediaScannerConnection.OnScanCompletedListener%29">static SCANFILE()
方法对 MediaScannerConnection
是您最好的选择恕我直言。
I've installed "android file transfer" on mac. My app creates a folder and creates a file in it (the permissions exist in AndroidManifest.xml), writes some data into this file. File exists, I can access it using standard file manager in my android device. It shows many folders, including my folder and I can even see the contents of my file on the device.
But the problem is that "android file transfer" shows me all other folders, but not my folder and my file. I even tried create just a single file, not a directory. Same result.
Unplugging the device or re-launch of "android file transfer" didn't help.
Maybe "android file transfer" is broken tool?
Maybe "android file transfer" is broken tool?
No.
On Android 3.0+, you need to have your file be indexed by the media scanner before it will be visible over MTP to your Mac. The static scanFile()
method on MediaScannerConnection
is your best option IMHO.
这篇关于Android的文件传输无法看到应用程序创建的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!