Android NFS Client

SoulaimenK picture SoulaimenK · Jan 10, 2020 · Viewed 9.3k times · Source

I have found a good library to implement an Android NFS Client 'nfs-client-java', I'm creating an Nfs3 Client and I can access files and create new files... on the server. But the problem is that I can't mount the whole shared directory from the server. On Linux NFS Client, I can specify the mount point with

mount -t nfs -o nolock,rw,vers=3 192.168.1.10:/media/user/ /mnt/media_rw/remote

where /mnt/media_rw/remote is where the shared directory will be mounted.

My question is: How can I achieve the same result on Android App ?

Answer

guest picture guest · Jan 15, 2020

In Android app development, there's no mounting at the Linux vfs layer. So you wouldn't be able to achieve exactly the same result.

There closest thing I'm aware of is the documents provider system https://developer.android.com/reference/android/provider/DocumentsProvider. From the documentation:

A document provider offers read and write access to durable files, such as files stored on a local disk, or files in a cloud storage service.

You'd implement methods such as openFile in your NFS documents provider by, for example, downloading a copy through the library you found, opening it, and forwarding a parcelable file descriptor in the return value.