Getting files to/from android phone

I am having trouble to access the filesystem on my phone (it's a samsung / google galaxy nexus). It just worked in previous version of Ubuntu, but now it appears empty whether it is mounted with MTP or PTP. I have followed a few guides on building and reinstalling libmtp etc without success. This answer did not help for me, either, and gMTP just hangs when I click the connect button. I know I can use wifi e.g. airdroid to access my photos, but this is too slow and a bit clumsy for me, and downloaded photos lose their original timestamps.

Has anyone had success connecting to this phone on 12.04 ??


Solution 1:

Pre-requisites

First, install the necessary packages:

sudo apt-get install mtp-tools mtpfs

A bit of elbow grease

Connect your Android phone to your computer. On your phone, open up the notification drawer, and click on USB Connection type. Make sure that MTP is selected.

MTP Mode

Now, run these commands on Ubuntu:

mtp-detect | grep idVendor
mtp-detect | grep idProduct

Note down the numbers written in front of idVendor and idProduct. You'll need those later on.


Now, run this command:

gksu gedit /etc/udev/rules.d/51-android.rules

A Gedit window should open up. Type this text in it, all in a single line:

SUBSYSTEM=="usb", ATTR{idVendor}=="VENDORID", ATTR{idProduct}=="PRODUCTID", MODE="0666"

Replace VENDORID with the idVendor you had noted down earlier. Similarly, replace PRODUCTID with the idProduct you had noted down.

Save and close the file.


Disconnect your phone and run these commands:

sudo service udev restart
sudo mkdir /media/androiddevice
sudo chmod a+rwx /media/androiddevice
sudo adduser yourusername fuse

Replace yourusername with your Ubuntu user name. Now, run this command:

gksu gedit /etc/fuse.conf

In the Gedit window, remove the # at the beginning of the last line (the one that begins with #user_allow_other). Close and save the file.


Restart your computer, and then run these three commands:

echo "alias android-connect=\"mtpfs -o allow_other /media/androiddevice\"" >> ~/.bashrc
echo "alias android-disconnect=\"fusermount -u /media/androiddevice\"" >> ~/.bashrc
source ~/.bashrc

Reconnect your phone, make sure it's still in MTP mode, and then run this command:

android-connect

Ta-dam!

You may now browse your Android phone's contents using Nautilus. Just fire up the file manager, and then in the side bar click on your phone's name to browse your phone's filesystem just like you would with a USB stick. You can add, remove and modify files just like a normal file system.

Phone filesystem


You might have noticed, however, that you cannot use the Nautilus eject icon to disconnect the phone. Instead, to safely remove the phone, you need to run the command:

android-disconnect

From now on, you will need to run android-connect to mount your phone and then android-disconnect to safely remove your phone. Everything else should be handled automatically.

Note: These two commands won't require root permissions to run. All users who are members of the fuse user group should be able to run these commands without root access.

You're done

That's it! You've successfully connected your Ice Cream Sandwich phone to your Ubuntu computer.


Source: OMG! Ubuntu!

Solution 2:

As I wrote in this thread, there are several solutions.

Given that you don't have a rooted phone, you can't install Samba Filesharing and have traditional samba shares on your phone.

But looking at this thread, it seems that ASTRO File Manager plus its SMB Module can work even without root access (not tested by me, can't confirm). AirDroid could be another alternative to test.