Donn Felker's Introduction to Android Development on TekPub

by Aaron 4. September 2010 04:31

I don't want to say that I'm not a creative person, but I don't usually come up with new ideas of my own.  I could never come up with a name like CompuGlobalHyperMegaNet for an internet company.  Can I have some money now?

If you don't get it, then Google/Bing it.

Maybe I just don't recognize the problems around me.  I'm a fairly rigid person when it comes to change.  I adapt to my environment, and live with it.  So, it comes as a surprise that I came up with a couple of mobile phone app ideas of my own.  Make no mistake: my ideas aren't original, but the implementation of them will have my own little flair to them.  They'll interact with each other, and help you save money.  But not on your insurance.

I'm not telling you what my ideas are right now though, because that's not the point of this post.  "But Aaron-" Shut up and read!

The point of this post is, I want to make these apps for my phone, and my wife Sarah's phone, but I don't really know that much about Android development.  Back in January, I won a one-year subscription to TekPub at Codemash.  I activated it just before it expired so that I could get the most out of it.  I'm short on time you see, and I figured if I waited, I would get more time.

There's a series named "Introduction to Android Development" by Donn Felker.  I love it!  At the time of this writing, there are 5 episodes available.  I'm about halfway through the 3rd episode (I'm taking a break while I download and install Git).  I feel like i could actually create a mediocre app now for my phone.  I say mediocre, because there's a lot more to cover in the series, and I've only watched up through some basic layout.

The first was an entry-level "Hello world" kind of thing.  At the end, he guides you through installing the development tools that you need.  Not to say that there aren't other tools that you might want to use, but these are the minimum things that you'll need to use.

The second covers the architecture.  It explains how the operating system works with the apps, the architectural layers in the OS down to the kernel, and explains the framework building blocks and application interactions through intents.

The third episode, that I'm currently watching, goes through starting to make a nice-looking app for TekPub.  This app is going to span multiple episodes in the series.

I've been following along by building the application as he walks through it.  While he has all of the code typed up in snippets so he can copy and paste, I'm typing everything by hand.  This is one of the ways that I learn: by doing everything manually, then learning how to do it through tools or other automated/assisted fashion.

This is why I needed to install Git though, so I could download the codebase.  Not for the code though.  I'm reproducing that by hand.  I need the images.

Now that everything is done downloading, I've rebooted already in that time because I downloaded and installed TortoiseGit as well, I'm going to get back to watching the video.

In the meantime, if you're interested in doing some Android development, or you'd like to learn more about it, I recommend getting a TekPub subscription, or  at a minimum, start buying and watching this series.

Tags: , , , , , ,

The Droid Eris and Froyo

by Aaron 30. August 2010 10:18

I bought an HTC Droid Eris at Christmas of 2009.  Some may ask, "why didn't you buy a Motorola Droid?"  Honestly, this is my first smartphone.  I knew that I wasn't going to hog wild with it.  You're talking to somebody that had a Motorola E815 followed by an LG enV2.  Over the years, I always felt that I made pretty intelligent, educated phone decisions.  This was no exception.

I bought the Droid Eris knowing that it came with an old version of Android and was later going to be updated.  I started getting pretty irritated when the update came later and later, but eventually it came.  When it did arrive OTA on my phone, I cackled maniaclly and rubbed my hands together in an evil, anticipatory way.  I now have a phone that officially supports Android 2.1.  I rule.

Seriously though, the interface just seemed a little more refined.  The icons looked a little nicer, the phone acted nicer, and I'm pretty sure I lowered my cholesterol.

Soon phones around me started getting updates to Froyo.  No, no, no.  Not this guy:

Frodo Baggins

That's "Frodo", silly.  No, Froyo is the name for Android 2.2.  It's supposedly about 10% faster than the previous point release.  It has some fancy new features.  People love it.  But I don't have it.  There's only one way for me to enjoy Froyo just like other people: hack my phone!

I'm no stranger to hacking embedded devices.  Or rather, I'm no stranger to using rooted images and then doing my own thing with them.  For example, I bought an internet appliance years ago called the Audrey.  It was a small internet appliance that allowed you to check your email, browse the web, and look at the weather.  It was a smallish touch screen appliance with a tiny keyboard, and did very little else.  Much like the Android though, there was a large community for it.

3COM Audrey

I found a site called AudreyHacking.com that had TONS of information on flashing the Audrey with what essentially amounted to a rooted image.  There were in fact, lots of images.  I even learned how to create my own, and I did.

The operating system for the Audrey was QNX.  It was a realtime system based on Unix.  I don't remember what it means to be a real-time operating system, but that's not important to the story.  The point is, I hacked the crap out of that thing.  There was an MP3 jukebox application that I downloaded the source code for.  I double-booted my PC to boot up into QNX so that I could tweak the app.  I updated it, uploaded it, and I used to use it as my MP3 player.

Also, I'm a big TiVo junky.  If you looked at the diagram from my Linux router posts, you'll notice two TiVo icons.  That's because I have two TiVos on my network: a Series 2 TiVo and a TiVo HD.  My first TiVo was a series 1 by Sony.  It was a gift from some friends.  It was fantastic.  Again, huge community for TiVo.  I hacked the Series 1 by first upgrading the hard drives with more storage than I could possibly use.  I also put TiVo Web on there, and a couple of other things.  The modem dies, so I put a network adapter into it.  If you're familiar with the series 1, there was no TiVo supported network adapter, so you'll understand that again, I had to hack it.

The Series 2 was locked down, so the most I could do was upgrade the storage on it.  Again, more storage than I can possibly use.  I decided not to hack the TiVoHD, but I've regretted that one a bit.  I bought the supported 1TB external hard drive from Western Digital.  My TiVo has been flaky ever since.  I should have cracked the shell and just put a big internal drive in it.

Enough of my trip down memory lane.  The point is, I decided to hack my Eris.  The first thing I did was read as much as I could to make sure that I could recover if I needed to.  I was getting some mixed information on what I needed to do.  I rooted my phone first.  Easy step.  I'm not sure that I needed to do it though.

Then I backed up my phone.  This is where I got really confused.  I was reading various things about backing up the phone.  I thought that I needed to use a solution named Nandroid.  I downloaded it and tried to figure out exactly what I needed to do.  I finally decided to simply try doing a "NAND Backup", which you can do from the recovery screen.  I was concerned because I didn't know if it was the right thing to do.  It was, and I'll get to that later.  If it was possible though, I should have taken a backup of my phone prior to rooting it.  Not because I feel like I need to be "unrooted", but just in case.

The next thing was to flash my phone with a Froyo ROM.  I chose the KaosFroyo ROM.  It was because I couldn't really find any other ROMs out there.  I figured this would be a good starting point though.

I rebooted my phone after flashing it.  I could tell that something changed because the splash screen said "ANDROID" instead of something HTC-related.  After it finished booting (many minutes later), I checked it out.  First thing I noticed after the initial setup stuff was the hideous wwallpaper that the developer decided to use.  Seriously, what made him stop, look at it, and say, "looks good"???

The next thing I noticed was that all of my apps were gone.  I don't know if I was suppsoed to back them up somehow and restore them, but I was a little psissed about it.  I justified it by announcing that this was "a good time to clean up my apps anyway."  I was still pissed.

I set up my email, contacts, and some of the apps that I remember having installed.  Unfortunately, when I installed the apps, it didn't pull in my previous settings, so I had to set them all up again.  Even more pissed now.

I started using the phone playing around.  I marvelled at things, but I noticed a lot of the little things I liked about my phone were gone.  The icons didn't look as nice anymore for some reason.  I didn't have the option in the power menu to set my phone to vibrate and back to regular volume.  I couldn't move email messages to other folders in the email app.  Some things crashed on me for seemingly no reason.  And where was all this speed that people raved about?  I saw somebody post that they did a benchmark and got a 410.  What the hell does that even mean???

I didn't like it.

So this morning, I decided to restore it back to the way it was.  I was concerned because I didn't know what was going to happen.  Was it going to be 2.1 again, but I'd have to download all of my apps again and reconfigure everything again???  No, that's not the case.

I did a NAND restore on my phone choosing the backup that I made.  Once it booted up, I could tell things were going my way.  My son was looking out at me over the screen lock bar.  I unlocked the phone with the same gesture and unlock pattern as before.  All of my apps were there, and everything was configured just the way I like it: my way.  I haven't had any issues, and I don't plan on ever trying that again.

Now, back to the point where I said I should have made a backup prior to rooting the phone, if possible.  My phone is rooted right now in it's current state.  Again, I'm fine with that simply because I'm a responsible user, comfortable with root access to my own devices.  But will I ever need to go back?  If so, I'm going to be going through some more work to figure out how to get rid of the root files that are on there.

My advice, if you want Froyo on your Android device, get one that officially supports it.  You'll probably be happier, and you can still root a lot of those devices granting you all the luxuries of a rooted device with Froyo.

Tags: , , , , , , , , , ,

Linux Upgrade Time Part 3: End Game

by Aaron 28. August 2010 10:25

The end is nigh!  Or whatever.

I have successfully turned my Linux box into a router.  It was full of trial and error, but I managed to accomplish the task.

The first thing I had to do, once I grabbed the firewall script from aboutdebian.com, I learned that I had to rebuild the kernel with additional modules.  It was a lot of searching through the menuconfig to find all of the proper modules, but I managed to do it.

I knew that I had everything installed in the kernel properly when I did a test run on the script, and my SSH connection froze after one of the startup messages.  So, I had to wander to the basement, turn on the monitor that I have conveniently left connected to the server, and reboot the box.  Unfortunately, I'm not sure what process(es) I have to kill to just stop the firewall features.

The next step was to get the network adapters working.  This took some effort.  I managed to drop the Linux box from the network several times.  Each time I had to go to the basement, undo what I did, and come back upstairs.  I got tired of that, so this morning, I simply sat on the floor in the basement, kept a laptop beside me that was hardwired into the internal interface, and used it to test after each trial and error change.

During all of this, I configured everything the way I thought it was supposed to be configured.  I finally figured out what I was doing wrong, again through trial and error, not because I knew it.  I just decided to "try it."  The the internal interface can't be on the same IP subnet as the external interface.  Sounds like something that maybe I should have known, or assumed.  Neither was the case.  Both the external and internal interfaces were on 192.168.0.0.  Once I changed the internal interface to the subnet 192.168.1.0, I was able to again browse the web from the Linux box itself.

The next thing I did was make sure that I could connect to the web through the Linux box from within the office.  If you refer back to a diagram in my last post, I had my Linux box (pictured as Joaquin Phoenix) acting as a router for my home office.  I was able to connect to the internet from the office.

Next I needed to make sure that DHCP was still working properly.  This is where I ran into a slight snag.  I configured the DHCP daemon to respond to requests only on eth1 (the internal interface), but I needed a DNS server to use.  Since my Belkin router was being replaced, and the network information it served up set itself as the DNS server, it made sense for me to do the same.  Unfortunately, my Linux box was failing as a DNS server.

It was s simple fix to simply install bind9.  I didn't have to do any configuration, I simply had to install it, and the package just worked.

The final test was making sure that I could connect to work by VPN.  Again, no problem.

Finally, this evening I did some last minute reconfiguration, swapped out the router, made a minor config change to DHCP that I overlooked just before making the switch, and voilà!  We have routing!

The first thing I did when I was sure it was working was go to Speedtest.net.  I can tell that my network connection is slower.  Since it's so noticeable, I was hoping it was a fluke, but it's not.  I'm getting about a third of the speed that I was getting before.  I'm not pleased by this, but I'm going to compare my routers choice to Verizon versus AT&T: if I can have a reliable, stable connection, I'll take it over the faster network any day.  Something seems to be flaky with Speedtest.net right now, so maybe it's not just me.

I will be investigating ways that I can speed up the network connectivity.  Maybe swap out my 10/100 cards for gigabit cards.  Maybe the higher throughput will help.  Who knows.  If only there was some place that I could search for information and only get results that are relevant to what I'm looking for.  And if that information was publicly available through some non-paper form where I could quickly peruse it and decide if it's useful or not.  I wonder what they would call that...

The other thing I need to do is configure the firewall script to do some port forwarding.  Other than that, I'll simply be watching for any network outages.  I hope this resolves my outages for me.  It's possible that I just have horrible luck with routers, and that this was all very unnecessary.  I just have a lot of trouble believing that four routers, at least one of which was totally fine prior to making it my firewall, were all bad.

Wish me luck and hope that I don't have to start a new trilogy of router upgrading.  I may be able to post some information that I find and utilize for speeding up my "new" router.

Tags: , , , , ,

Linux Upgrade Time Part 2: Rising from the Ashes

by Aaron 19. August 2010 11:28

From the ashes rises...well...some heat.  Maybe a little smoke.  Some ashes.  Mythically, a phoenix, but not a Joaquin Phoenix though.  My Linux box didn't certainly rise from the ashes.  Know why?  Because it's ROCK SOLID, BABY!!!  Maybe I'll still refer to it as a phoenix...

Seriously, it was pretty uneventful upgrading to the latest distribution of Debian.  I commented on my last post that I think I had to upgrade the kernel to a newer version, and to do so, I needed a pre-compiled version of it.  I remember now in more detail what was the dealio.

I wanted to upgrade the kernel to version 2.6 from version 2.2.  To do that, I needed to compile a new kernel.  To do that, I needed to upgrade the gcc library or something, and some other libraries, and compilers, and blah blah blah.  I ran into a chicken or egg issue where it appeared that I needed the newer kernel to get what I needed to compile a new 2.6 kernel.  Impossible!

So instead, what I had to do was find a pre-compiled kernel that fit my CPU architecture.  Unfortunately, it didn't fit the rest of my hardware architecture.  So I had to go through all the craptastic steps of building a new kernel.

This time around, I was able to just upgrade the distribution components.  Meh.  There were a couple of steps that I didn't know what it was doing, but everything seems to be working fine.

Now I'm working on creating my firewall script.  I found a site called About Debian Linux.  To be quite honest, this is one of the most informative sites I've ever found for working with my Linux box.

There's a page in the site that has a basic script on it for configuring a basic firewall.  I'm starting with that.  So far I've found that I don't necessarily have everything that I need.  I executed the script as-is with the minimal changes necessary to configure my network interfaces.  It's giving me a lot of feedback telling me that I may need to upgrade components, or the kernel.  If I need to rebuild the kernel, that's not an issue.  I have yet to hose the kernel in such a way that the server doesn't come back up.  Maybe this will be the first?

My plan of action, since I can't afford to upset the wife, is to configure the Linux box on a subnet of my network.  The external interface will look just like it does now to the existing router, but I'm going to plug the office "subnet" into the Linux box and serve up some tasty, tasty routing from there.

Here's approximately what my current network looks like:

 

You can see that I've got the Linux box on one node by itself, and there are three switches, each with a wireless access point.  I hate Dead Zones.  Not the novel or popular TV series by Stephen King.  The wireless kind.  I actually like the Stephen King kinds.

Once I feel the Linux box is ready for testing, I'm going to move it between the office node and the current router.  The temporary, proposed network will look approximately like this:

This will allow me to test routing and such through the Linux box from within the office, and allow the rest of the network to function normally.

Once I feel that the Linux box is working and ready, I'm going to replace the existing router with the Linux box.  I'll plug in a switch for the rest of the network, and the final network will look something like this:

Stay tuned for Linux Upgrade Time Part 3: End Game!

Tags: , , , , , ,

Linux Upgrade Time!

by Aaron 17. August 2010 09:29

Over the past few weeks I've experienced some ridiculous network behavior.  It started with an old Linksys router that was in place.  It started dropping my network connection, but I was still able to see all of the rest of my network.  I called Time Warner.  Went through all the hoops, unplugged my router, then plugged it back in...  My router wouldn't power back on.  This is router #1

At this point I think, "not so smart now are you, Aaron?!?"  My own router, and I never suspected it.

I took a different router down there (router #2) and plugged it in temporarily, until I could get a new, better one.  I bought a new one (router #3).  New issue: the router randomly drops the entire network.  So I plug router #2 back in.  This one seems to drop the external network randomly like router #1 did.  I can still see my network, but I can't get out.  Stranger still, I can get into my network from the outside.  It's like the router is losing all of the DNS server information.

I buy another Linksys (router #4).  This one reboots randomly.  Again, I go back to router #2.  No new issues, just the same old ones.  I don't think there's an issue with my hardware, although it's possible.  I think somebody's attacking my network, and something about the attack is doing this nasty business.

I took back router #4, and just today I bought a new network card.  This time, I'm going to build my own router.  I want to capture as much log info as I can about the issue, if it still persists after I do this, and maybe even shut down the attacks, if that's what is causing the problem in the first place.

To do this, I have a Linux box in my basement, running headless, that's very stable.  It's been running for years now.  I mean, this thing has been running since before I met my wife.  I've been using it as a file server, SVN server, web server, SSH server, Icecast server, TiVo home media server, DHCP server, local mail aggregator and server, and who knows what else.  It might even be lowering my cholesterol or car insurance!  And now I'm about to turn it into my new router and firewall.

About a year ago though, I decided that I wanted to upgrade some of the server software running on my Linux box.  I run Debian Linux, and the release I was using was Sarge I believe (version 3).  It took me a while to figure out how to upgrade, but I figured I wouldn't be disappointed.  It was HORRIBLE!

Once I finally fiugred out how to do it, it upgraded my kernel on me.  When I did that, it didn't have IDE hardware compiled into the kernel, so it wouldn't recognize my hard drive anymore.  I should also add at this point that the hardware is an AMD Duron 950MHz processor with a couple of IDE hard drives in it.  When I say I run it headless, the only time I plug a monitor into it is when it doesn't seem to boot back up.  That happened after the kernel upgrade.

I then had to boot up with a rescue disc (Trinity Rescue) and build a new kernel using the crappiest console interface possible.  I successfully got it back up and running though, and it's been rock-solid ever since.

I tell this back story because now, I have to do it again.  I'm afraid.  Like really afraid.  I hate the process, and I wish that it could be smooth and easy, but I suspect I'm going to run into the same issue.

The reason I have to upgrade to Lenny (version 5) now is because Etch (version 4) is no longer supported.  I want to look for and possibly use some routing/firewall apps to help lock down my network.  I want to make sure I've got the latest, most secure crap running on this thing possible.  I'm mad as hell, and I'm not going to take it anymore.

I'm approaching my upgrade the same way that my wife approaches any problem: Google  Google.com is your friend.  The first link I found is perfect really.

I started by first putting in the new network card.  That's the first new piece of hardware to be installed in the Linux box in several years.  The only other new hardware was an additional hard drive.  The machine booted up without issue after installing the card.

Next I updated APT.  I started getting GPG errors when I tried to update the package cache.  I apparently needed some GPG keys, so I installed any keyring package that had the word Debian in it until my error went away.  the APT package cache is now updated.

Now, I'm about to install the dist-upgrade APT package.  That's where I'm going to leave off for now.  The box IS my DHCP server, and if it goes down, so does the connection to my network from this laptop.

Stay tuned for Linux Upgrade Time Part 2: Rising from the Ashes.

Tags: , , , , , , , , ,