1

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.

hin
  • 79
  • 1
  • 1
  • 8

1 Answers1

2

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 )

jelmer
  • 2,405
  • 14
  • 27
Luigi R. Viggiano
  • 8,659
  • 7
  • 53
  • 66
  • 3
    Thanks! I used the jar from the jcifs library (http://jcifs.samba.org/src/jcifs-1.3.17.zip) and this example http://lists.samba.org/archive/jcifs/2007-September/007465.html. At first I got aa ExceptionInInitializerError (maybe because I did run the code in the main thread for testing), which could be solved by ThreadPolicy tp = ThreadPolicy.LAX; StrictMode.setThreadPolicy(tp);. – hin Jan 08 '13 at 20:20