The CommonsBlog


Samba and a Uri

As noted by Android Police, Google has released a Samba client app for Android on the Play Store. Users can use this app to connect their device to a SMB/CIFS file server, which is the protocol typically used for Windows file servers.

And, as you can see from the source code, the implementation is a DocumentsProvider. Any app that uses ACTION_OPEN_DOCUMENT, ACTION_OPEN_DOCUMENT_TREE, or ACTION_CREATE_DOCUMENT can now work seamlessly with Windows file servers… except for those apps written by developers who keep insisting that a Uri always points to a local file.

If you are using these Storage Access Framework actions, the Uri that you get back does not have to point to anything on the device’s filesystem that you can access. Always use a ContentResolver and openInputStream()/openOutputStream() to manipulate the content. For more, see this post from March 2016.


Stuck on an Android problem? Subscribers have access to live office hours chats with Mark Murphy, to help you work through your challenges!