How to access share folder in windows through android and read files

谁说我不能喝 提交于 2019-11-26 23:19:20

问题


I need to connect from my Android phone to a Windows PC share and access files. I saw some sample apps in Android market that access share folders using smb/samba. But I have no idea about how to create an app like that. Thanks a lot.


回答1:


You need to get JCIFS and use SmbFile class to interact with files over the network,

http://lists.samba.org/archive/jcifs/2007-September/007465.html

that is a quick example of how to list files, of coarse you need internet permission on. So Far though everytime I try to call SmbFile.listFiles(); I get an UnknownHostException, However others seam to be able to do it with no problem, this might work for you, try it!




回答2:


Google has released a simple, free Samba client. It is on github so you can have a look and use whatever you need out of that: https://github.com/google/samba-documents-provider

The other option is JCIFS: https://jcifs.samba.org/. There you can find the library and examples on how to use it.



来源:https://stackoverflow.com/questions/9389366/how-to-access-share-folder-in-windows-through-android-and-read-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!