Access local network files with android

hin picture hin · Jan 8, 2013 · Viewed 12.2k times · Source

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.

Answer

Luigi R. Viggiano picture Luigi R. Viggiano · Jan 8, 2013

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 )