简体   繁体   中英

How to open files in Android with default viewer using jCIFS

I'm using the free jCIFS library to connect to my NAS device via CIFS, and it's working great. I can connect and get a list of filenames, etc. without any issues.

Now I'd like to open one of the files in the default Android application - ie a music file should be opened in the music player, an image in the gallery, video file in a video player and so forth. The issue is not really about getting the MIME type and so on. The issue is that I don't want to download the files first, they should be streamed .

Does anyone know how this can be achieved? I know that CifsManager (another third party application) is capable of doing something similar, but it doesn't use jCIFS and it requires root access to mount drives. It is essential that my application doesn't require root access.

You can find the jCIFS library here: http://jcifs.samba.org/

You can use the SmbFileInputStream to read the file.
Please go through the documentation jcifs.smb.SmbFileInputStream

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM