Skip to content

Posts tagged ‘Android development’

16
Nov

E-Books ups and downs

Almost a year ago I blogged about getting a Kindle and how I was pleasantly impressed by it (that’s an euphemism for being totally blown away). It’s been 11 months and in this time I have downloaded 58 books on my Kindle. Wow! Now I say download and not bought because about half of these are free ebooks that you can get on Amazon (mostly classics). Out of all these I read probably about 20-25. In case you’re wondering how do I end up getting more books than I actually read, that’s an interesting topic that I’ll touch on another time.

 

Regardless, that’s still a lot of books read and a lot of books bought. I can say with certainty that I bought more books this year (using the Kindle) than in any year before because of the convenience. Nonetheless, among these numerous books, free or paid, there is not one technical book. I just never bought an ebook that I would be directly using in my work. There are several reasons for that:

  • Kindles are great for reading a novel from start to end, but not that great for flipping through pages and going back and forth
  • I don’t even notice the screen lag when I’m reading, but it would bug me a lot if I were going back and forth between a few pages (as I often do with reference books) or if I was searching for something specific
  • No color makes many figures and screenshots useless and most others hard to read
  • The screen is small by “tech book” standard. This is perhaps a weaker argument since there are larger Kindles, but for me it’s an argument nonetheless
  • Old habits die hard… I just like having the reference book next to me so that I can flip through it, make notes and of course throw it at the wall when code crashes!

Recently though I did purchase what is most probably my first technical e-book. I actually bought three of them in a pack. These are the Android Books from CommonsWare and again there are several reasons why I decided to buy these. As tech books go, these are quite cheap actually so it’s not a huge gamble if it turns out to be a bad idea, I could check on the author (by observing his inhuman rep on StackOverflow and the way he explains things there) and they actually seemed quite promising in terms of quality. But really, the one selling point that got me to decide on this almost immediately was getting Free updates for one year.

Now let met just stop there and expand on that. Free updates for any period of time is a HUGE thing in technology documentation, especially with something young like Android that mutates into something new every 10 minutes or so. My previous book on Android was outdated by the time I purchased it. By the time I finished it, Android was something else altogether. Updating books is something that you can’t have with “dead trees” and I cannot overstate its importance for tech books. I believe this to be the strongest argument for getting tech books electronically. Unfortunately, not all ebooks come with this benefit (actually…most don’t as far as I know), so the argument becomes rather null. It’s sad to have a medium with so much power, but find it not be used to its full capability.

 

Of course, I’m now back at my original concerns. Having this new ebook I was faced with the challenge of…well…using it. This is for personal work and I’m doing that off a laptop now which means that I don’t have three screens so that I can put the book on one and just work as normal. Lion’s fullscreen mode plus gestures actually helps a lot, it’s easy to switch between the book and the environment… but I still have to switch, which is a bit annoying (for those of you confused, I was spoiled by working on two 24+21 inch screens for a year; you just can’t really ever get over the experience of 40″+ of screen space).

Among my numerous options with these ebooks, I could get a Kindle version of the book so I could put it on my Kindle, but I run into the problems I was previously mentioning. Again, call me fussy, but I just can’t see myself using my Kindle for a tech reference.
I think this is where I become interested in having a tablet. I can genuinely see that be useful for something like this. A 10″ screen is decent size and if going through pages is as smooth and quick as it is on the computer, that’s great. Since the reasons for getting a tablet are adding up, maybe once the Kindle Fire makes it to the UK, I’ll look into that.

(You know, it’s funny how when the iPad came out I was completely unmoved and considered it a dumb idea and as time went by, I slowly started buying into the whole tablet thing; I hate to admit something like this, but in this case Steve was absolutely right… I had no idea what I wanted until he shoved it in my face. Damn!).

15
Oct

Android USB connection to PC

Back a while ago I wrote a post regarding USB cable communication between an Android smartphone and the host machine. I promised some code back then, but forgot to put it. Here is some sample code now.
Read moreRead more

15
Feb

Communicating over the USB cable

For the eTegrity project I’m working on for my senior design, I needed the smartphone and the computer to communicate over a USB connection. This turned out to be an unusually difficult thing to figure out, but really simple otherwise.

Now, an important thing to note here is that it does require software to be installed on the host computer, specifically the adb tool from the Android SDK and of course the driver (this depends on your OS, see details here)

That being said, all you need to do is to activate port forwarding using adb. What this does is it maps a port on your local computer to a port on the smartphone. For example:

adb forward tcp:1234 tcp:1234

If it returns no message, it executed correctly, otherwise it could be that the port you specified cannot be binded on one of the two machines or some other issue (it will tell you). The link above is great for figuring out how to use adb, so just check it out.

Then, you can go ahead and implement regular sockets on both machines. For some reason, at least in my case the server socket had to be on the smartphone, all attempts to have it be on the computer failed. So put the server socket on the phone, client socket(s) on the computer and you’re all set.

Make sure when you implement the socket on the phone that your application specifies the “INTERNET” permission in its manifest. I know, you’re only trying to do a local network connection, but you need that to be able to open sockets.

I’ll try to post some sample code to go together with this explanation soon.

Notes:
- I am using a Windows XP SP 3 box and an HTC Hero phone (running Android 1.5)
- I believe that in Linux there is a simpler way of doing this, but I haven’t tested at all
- You do have to run the adb port forwarding command again after reboot
- Since 2.0 they introduced Bluetooth so you can just do the socket thing over Bluetooth directly without the adb stuff. Then again, not many devices out there running 2.0 right now as far as I know.

Later Edit: Some sample code here.

15
Feb

Android category

I’ve just added a new category called Android. I’ll be posting here various things related to the Android architecture that I find interesting as I’m digging my way through it. And of course, my usual skeptical criticism.
Stay tuned!