سؤال

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.

هل كانت مفيدة؟

المحلول

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!

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top