I'm looking for a way to mount Samaba shares programatically.
I am aware of this question which, if it works, would allow browsing a Samba share within my app, but I want the shares to be available to other apps once mounted.
I know ES File Explorer can do this, so it must be possible to implement in code, but I'm trying to figure out how it's done. The only method I can think of is opening a Process with Runtime.getRuntime().exec(...) but then there's the issue of what commands to send. I've been playing about in a terminal emulator app and the standard mount command doesn't seem to be working. I've tried the following:
mount -t smbfs //[ipaddress] /mnt/sdcard/net/Share1
and
mount -t cifs //[ipaddress] /mnt/sdcard/net/Share1
but in both cases I'm getting the rather uninformative error message "mount: no such device"
Where could I be going wrong?
Probably smbfs/cifs are currently not supported by your kernel. As Delyan said, ensure your kernel can mount these filesystem :
$ cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev cgroup
nodev tmpfs
nodev debugfs
nodev sockfs
nodev usbfs
....
If they are not listed, you should try to do a modprobing (sometimes the module you want just have to be activated), get root access then :
# modprobe <modulename(without.ko)>
e.g. :
# modprobe cifs
If it doesn't work you will have to change or recompile your kernel (including appropriate modules).