Android - Connect my lollipop device via USB in mass storage mode
Connecting your phone via UMS (USB Mass Storage) won't be possible. It's been removed from Android, so the only way would be for you to fork the Android source and program it in again. I assume that's not what you want to do. There were a few reasons for this, but mostly because UMS is prone to crash third-party apps and also files cannot be dual accessed from apps and the computer simultaneously. MTP isn't really bad per-se, but unfortunately the support in Windows is lacking. A colleague of mine uses MTP with Ubuntu and is very happy with it.
Here are some suggestions about what you could do though:
- If you really want to transfer files via USB, you could do that with
adb pull
andadb push
. You could make a little script that runs as soon as you connect your phone and synchronizes a specific folder. - You could, and this is the most comfortable way, install a samba server on your phone. That way you would be able to mount parts of your phone's storage on your computer, as soon as it is connected to your WiFi. The bandwidth would probably also be enough to directly play music files, maybe even videos (depending mostly on the number of antennas your phone has). For that solution, please have a look at these two apps SambaDroid, Samba Server as well as this question regarding root access Using SMB server without root access.
- Another option would be running an SSH server. You can then also mount remotely with SSHFS on Linux and OSX. For Windows I recommend SFTP Net Drive, which is free for a single connection and personal use. Advantages over SMB would be that file transfers are encrypted and that it's more suitable to also be used over WAN. Also it already comes with file integrity checks. Disadvantages would be that over high latency connections (WAN), speeds might drop significantly due to physical limitations from the bandwidth delay product.
- Last but not least, there is the option, if you're on Linux, to use adbfs. It is using FUSE to mount your adb connected phone. So it will appear just like any other mount. This is probably the closest you can get to what was UMS.