Saturday, August 28, 2010

I managed to get a program written on my computer running on my phone. Which might not sound much, but it was a lot more work than I thought, and I tried a lot of things that didn't work, so I thought I'd record what I did for the benefit of anyone else.

And now, here are the steps I followed. They might not all be necessary, but they worked.

Precursors

Get the hello world app working in eclipse in the emulator as described in the link above, before going anywhere near the phone.

Reboot. This was just because I gave up one evening, and started a few days later but had the side benefit of stopping the adb daemon.

Get the machine to a clean state. While trying to get this to work, I had tried and failed with quite a lot of methods. These included installing other apps in the hopes of getting drivers, downloading random driver files off the internet and so on. Since I didn't trust the driver state of the computer, I restored to a system restore point when I hadn't done anything with the phone. So now we probably have no samsung drivers.

Now we are going to get the phone nicely connected to PC, pretending we are just a normal user, not worrying about being a developer.

With the phone disconnected from the USB cable, under Settings, Applications, Development, turn OFF USB debugging.

Under Settings, About Phone, USB Settings, change to "Ask on connection". This will give you some control.

Installing Kies to get drivers

Now we want the proper Samsung drivers, and we are going to rely on Samsung Kies to do it. Download Samsung Kies from the Samsung website: http://www.samsungapps.com/about/onPc.as. Install it, and reboot if it requests. Now whenever your phone connects in whatever mode Kies will try and take over.

Start up Kies manually. Connect your phone, and when it asks you choose mode choose Kies. Windows should install some drivers, then Kies should detect it and show it in the top left corner.

Eject the phone from Kies, and unplug the cable.

In the Kies tray menu, turn off Auto-start, and quit Kies.

Install as a USB drive to get drivers

Now we want to make sure using the phone as a USB drive works.

Plug the phone in. Kies shouldn't start. Choose "Mass storage" on the phone. Windows should install some more drivers. It won't show yet as a working drive.

On the phone you have pull down the notification screen, which should say "USB connected".

Click on this, and will give you the option to Mount as a drive. Select Mount.

Check you can copy a file back and forth.

Eject the USB drives from Windows and disconnect the phone.

Now you should have a nicely working phone like a normal user, and hopefully all the drivers installed you will need. If you can't get here, don't vene bother with the next steps, you've got to get the phone working first. Try uninstalling Kies and reinstalling, or uninstalling any 3rd party software for use with your phone.

Being a developer

Next we are going reveal our true identity as developers.

IGNORE everything it says at http://developer.android.com/sdk/win-usb.html. Having the package provides drives for a few specific phones. Having it installed won't hurt - I've got it installed, but don't expect it to help. You've got a Samsung Galaxy S, and the package doesn't support this at all.

On the phone, with it disconnected, under Settings, Applications, Development, turn ON USB debugging.

Connect the phone. Windows says it is installing device driver software - a good sign. However, on my machine it then says Device driver software was not successfully installed - a bad sign! But DON'T PANIC.

Go to Control Panel, Devices, Hardward and Sound. The phone should appear as SAMSUNG_Android with a list of all the things it can be. This is good. It appears Windows was lying.