I want to acces files on my LAN (on a NAS or PC) by an Android app like I can do on Windows by typing \pcname\ in the explorer. I know this is possible on Android, because there are other apps that do this (e.g. https://play.google.com/store/apps/details?id=com.rhmsoft.fm).
I already tried accessing the file as a local file (new File("\\pcname\")). Needless to say this did not work. I searched the web for tutorials, but every tutorial I found was using ftp, http and so on.
Using java.net.URL you can use ftp urls like ftp://servername/path/to/file
. To access windows share, you need to use the SMB protocol (there is similar question: How to access share folder in windows through android and read files )
来源:https://stackoverflow.com/questions/14222219/access-local-network-files-with-android