Monday, November 9, 2009

Mounting the Droid SD Card as a USB Drive

It took me a few times to figure this one out. Again, this is for the Motorolla Droid and Ubuntu 8.1 64 with the Droid connected via the USB cord. Ubuntu was configured for the USB device as outlined here.

Once the USB device is connected (the USB symbol will appear on the Droid's title bar on the left), click the menu button from the home panel. Then select the Notifications button.

The Notification button will bring up a list of temporal and stateful messages but one of them will say

USB connected
Select to copy files to/from your computer

Like this:

Click on that panel and a dialog will prompt you to mount the Droid via USB. Select Mount and your PC should detect it and you will have access to the Droid's SD card file system.


Interesting side note: If you notice in the list of notifications, there is a also a notification about USB debugging connected. This is not required in order to mount the USB device, but it was required for me to get a screen capture. I poked around the Android Marketplace for a utility to capture screens. I found a few, but they all required a rooted system which I have understood to mean an Andoid device on which you know the root password, or on which your primary user account has root privileges. This appears to be a well documented procedure which I have not tried yet. Actually, there's a couple of variations which range from a simple telnet hack to a very dangerous sounding SD Card reboot that is just begging for some poor [screen-shot covetting] shnook to destroy his Droid with. I am just guessing here, but I suspect Verizon will take a very dim view to support requests coming in that smell of this type of activity.

If you have done this (successfully or otherwise) and are not commonly wont to hacking into any electronic device in your vicinity, drop us a note here at Not Annoid. Alternately, if you have devised a means of taking screen-shots on an Android device without root access, hook your brothers up. (Unhooking the camera and pulling it around the front, dangling by a thin wire, or tricks with multiple mirrors need not apply)

It did get me thinking though, as I was driving back from Rhode Island on Sunday night. I was scoping out the new Google Navigation system which is Google Maps combined with some helpful graphics and turn by turn sounded out directions. I know my way home from Rhode Island and I could drive it in my sleep (I think I actually did once or twice) but I figured I would check it out and see how it compared to my Garmin. Now my Garmin is a little on the older side. Yes, it is about as big as the first television set I ever owned but it has guided me out to the most difficult regions in the world to get to, and back again, so I am rather fond of it. (Yes, I mean Long Island.)

There are some rather interesting differences between Google Naviagation and the Garmin interface but I am not sure how to bring up the view now that I am not on the exit between the New York Express Thruway and Interstate Highway 287. At the time that I was there, I started wondering how I might grab a screen capture so I could convey some interesting tidbits to you. It did cross my mind for a second or two that my laptop was about 2 feet away and I could whip it out, start it up, plug in the Droid, start adb, start up ddm, connect to the Droid and capture a screen shot. Now if I was texting, that might have an illegal activity to perform while driving, but it wasn't, so I could have.......

Once I figure out this screen-capture business, I will drive back to the border of New York and New Jersey and revisit the Google Navigation items for your edification and blog reading pleasure.

Saturday, November 7, 2009

[An]Droid First App Deployed

---10 minutes later---

Despite my earlier problems, I was able to actually create a Hello World application and deploy it to my Droid. The application itself was a 45 second quickie with virtually nothing done to a standard Eclipse Android project. Once the device was plugged in using the USB cord and was recognized by Eclipse (albeit with some of the buttons disabled), the deployment itself was trivial, as outlined here:


Yup, just:
  • Right-Click on the project.
  • Select Run-As
  • Select Android Application
The way this worked was that I am running the adb daemon as root, launched from a sudo'ed shell. This established a privileged connection to the Droid. When I switched to the DDMS Perspective in Eclipse (running under my own user id) , it warned me that the debug port was already bound, but the device view displayed the Droid device just fine.



If you have more than one device/emulator attached, or you have a device and an emulator attached, you will be prompted to pick a deployment target:


I picked my Droid to deploy to and a split second later, it popped up on the Droid's display:


As an aside, the icons on the top bar there (left to right) indicate:
  • A current USB connection to the device is active
  • The application is running under Debug mode
  • The device's Bluetooth radio is turned on
  • The Verizon 3G network radio is turned on
  • The device's Wifi radio is turned on
  • The battery is fully charged
As simple as this application is, I feel like I have a significant accomplishment under my belt now. Just another 300,000 lines of Java and XML and I should have a real application.

[An]Droid Device and USB Driver Configuration

As I mentioned in my last post, the Eclipse Android plugin Device panel shared my view of the state of its recognition of my Droid phone when I connected via the USB cord:

???????????? no permissions

When I got up this morning, feeling a little more patient and investigative, I found these two pages which resolved this problem:

Outline of Connecting Devices via USB
Tweaking the Rules File for USB Devices and Permissions

I am running Ubuntu 8.1 64 and I was able to get a recognized device by changing my rules file (/etc/udev/rules.d/51-android.rules) to:

SUBSYSTEM=="usb|usb_device", SYSFS{22b8}=="0bb4", MODE="0660", GROUP="plugdev" SUBSYSTEM=="usb|usb_device", ATTR{22b8}=="0bb4", ATTR{idProduct}=="0c02", SYMLINK+="android_adb" SUBSYSTEM=="usb|usb_device", ATTR{22b8}=="0bb4", ATTR{idProduct}=="0c01", SYMLINK+="android_fastboot"

However, when I run ddms or Eclipse as any user other than root, I am back to the same no permissions error. I assumed that the GROUP="plugdev" bit would fix this (my own user is part of that group) but no.

So, in summary, when I run as myself, this happens:

.../android-sdk-linux/tools$ ./adb devices List of devices attached ???????????? no permissions

But then I ps -ef | grep adb, kill the adb fork-server server process and then run the same with sudo:

.../android-sdk-linux/tools$ sudo ./adb devices * daemon not running. starting it now * * daemon started successfully * List of devices attached device

Small inconvenience for now, I suppose. Until I figure this out, it is actually more convenient to use the standalone ddms (Dalvik Debug Monitor) tool (a direct analog of the Eclipse plugin but outside of Eclipse) since I can run that as root but continue running Eclipse under my own user.

---Update 4 Minutes Later---

Although the device is recognized now, it still does not report all the details one would see when attached to an emulator, such as Threads, GC etc. I can view logs and system/process details, but with all the interesting buttons greyed out, I am obviously not fully connected yet.


One thing I can do, though, is capture screen shots.


Perhaps tomorrow morning.........

Friday, November 6, 2009

Not Annoid With Droid Day 1

Just picked up my Droid about two hours ago, and I must say, I am pretty delighted with it. I started noodling with the Android 2.0 SDK and Eclipse plugin about a week ago, and started reading Ed Burnette's Hello Android but the real thing has been a little distracting. As I write this, the droid is sitting here, plugged into my Ubuntu Laptop, beeping quietly when I get a GMail and playing the latest Grails Podcast.

I had a chance to mess around with Sandeep's iPhone and while there are probably legions of Apple accolytes declaring a no-contest, this is clearly not the case. Admittedly, the 4 billion available iPhone applications do slightly outnumber the 10k or so for Android, I observed some similarities and differences.
  1. The user interface is just as smooth in the Droid as it is on the iPhone. Granted, the iPhone UI has the elegance and sophistication of a Bahaus architected drawing room, but the Droid is every bit as snappy and has what I consider to be a more intuitive layout. That is to say, the Droid has a layout and flow that is more like a typical desktop, excepting that you have to swipe to move around the whole virtual desktop. (It was commented on somewhere that the Droid would appeal to technical folks. Not sure if this is what they meant)
  2. The Droid's screen is large and bright and as unrefined as my finger motions are, I can still move my way around the apps.
  3. The Droid is slightly thicker than the iPhone (and supposedly 1 oz. heavier) but I believe my pockets are rated up to 13 oz. past that weight. All the same, I am anxious to get some sort of case/protector for it but Dave from Madison Wireless said they got 15 Droids by UPS today, but no other accessories except a car charger. (So I bought one).
  4. The strongest similarity between the iPhone and the Droid is my inability to type more than 4 characters using the on-screen keyboard without fat-fingering. This is where the Droid's corporeal keyboard really shines for me.

Spreaking of accessories, one thing I miss from the old days of cell phones (and I mean cell) was the availability of cradles. My first Motorolla phone had a very nice looking cradle which even had an analog display clock on the front which was an affectation I liked on my desk but had to give it up when I got the next phone as the power adapter changed. And thank goodness for that too. As I remember it, the Razor was the first Motorolla phone that implemented a power plug with electrical connections more than 6 microns thick.

I use my iPod cradle every day but none of the last 4 mobile phones I have owned supported this notion. You basically get a chintzy power cord and that's it. Anyways, although it is not available yet, the Droid has gone beyond the cradle, let me tell you, and will be shipping something they call the Multimedia Station which my research indicates the iPhone does not have. On the other hand, it turns out that the Multimedia Station is...... a cradle, albeit a pretty snazzy looking one.
The rest of the accessories are standard fare.

So the real topic of this publication is the narrative of Android development on the Droid, and sadly, I must report, it is not off to a good start, although I must also confess a total of about 17 minutes spent on it. It will be at least another 3.4 minutes before I head over to stackoverflow.com.

I was absolutely flying with pretty much everything. I got the Droid hooked up to WiFi with no issue. I bound the Droid to two Bluetooth devices, my Jabra Speakerphone ('cause those ear pieces just look silly) and my laptop. I plugged in the USB cable and the Droid announces both the connection and the Android Debug Mode activation, the setting for which my hawk eyes spotted as I was galavanting through all the menus while still standing in Madison Wireless waiting for Dave to finish up the paper work.

Then I fire up eclipse. Eclipse recognizes the device, or at least, he thinks its a device of some sort. However, Eclipse's description of the device pretty much mirrors my thinking exactly:

It's always the way when you're starting out on something new.