So I\'m trying to write a file from android device to windows shared folder. I\'m using latest version of JCIFS and code which displays available network shares works fine. So I
OMG!!! Solution was so simple!!! To access network which is not login/password protected and thus doesn't need any authorization is not NtlmPasswordAuthentication.ANONYMOUS BUT it is:
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, null, null);
damn it wasn't that obvious!
try with this code
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("",
username, password);
sharepath = "smb://" + pathtosharefolder + test.txt;
sFile = new SmbFile(sharepath, auth);
SmbFileOutputStream out = new SmbFileOutputStream(file, true);
out.write(text.getBytes());
Also check you have share the folder path that you are accessing. Also check it has given write permission to the folder