Thursday, December 16, 2010

Roam Override Widget

New app on the Android Market today, the Roam Override Widget. The widget allows users of Qualcomm based CDMA phones to manually force their phone into a roaming mode. This is particularly useful for users who occasionally experience a weak, unreliable signal, but the phone will not roam to the stronger network. Unlike other options, this widget does not require root access.

Tested on the LG Optimus S, but should work on others. Give it a try and let us know your experience! Most custom ROMs do not include the software stack required for this to work. This app is targeting users who do not root or modify their ROM.

Tuesday, November 23, 2010

Android Applications I Use

Putting the applications I write aside, here's a list of the Android applications I have installed in no particular order. Applications in bold are used often. I'll try to get back to this list and update with descriptions or links.

  • Amazon
  • Angry Birds
  • Autozone
  • Barcode Scanner
  • Chrome to Phone
  • Congress
  • eBay
  • Epicurious
  • Facebook
  • Google Finance
  • Google Gesture Search
  • Google Gmail
  • Google Goggles
  • Google Buzz
  • Google Search
  • Google Sky Map
  • GPS Status
  • Hotspot Widget
  • IMDb
  • Google Maps
  • Mileage
  • Google My Tracks
  • Flixster
  • OBD II Reader
  • OpenSpark
  • Overstock
  • Pandora
  • Photoshop
  • ESPN Scorecenter
  • Shazam
  • Google Shopper
  • ShopSavvy
  • StopWatch & Timer
  • Swype
  • Target
  • The Weather Channel
  • Torque
  • Transdroid
  • Twitter
  • Urbanspoon
  • Google Voice
  • Google Voice Search
  • Wordpress
  • XBMC Remote
  • z4Root

Thursday, November 18, 2010

New Phone - LG Optimus S

My previous phone, the HTC Hero was once considered high-end for an Android phone. Back then, there wasn't much for choices, the Hero followed the HTC G1, and roughly matched the functionality of the MyTouch.

Today there are a wide variety of phones from junk to super high-end. I envy the owner's of the HTC EVO 4G, but it's difficult for me to justify the $200 up-front + $240 in additional fees over the 2 year contract. RadioShack and Sprint recently offered a promotion for the new low-end LG Optimus S for $0, no rebate required. That's $440 cheaper over 2 years than the EVO.

I took the plunge, and I'm delightfully surprised at just how nice the Optimus S. In many ways it's a big upgrade from my HTC Hero, but with a few caveats. Here's the quick rundown.

  • Stock Android 2.2.1 - Froyo tastes great.
  • Faster CPU. The 600mhz CPU is a big improvement, even beyond raw numbers.
  • GPU. Added acceleration for graphics. I can play Angry Birds now.
  • Slightly thinner, smaller.
  • More responsive touch screen.
  • Dedicated 2-stage camera button.
  • Dedicated voice dialer button.
  • No blinding notification light while charging
  • Proximity Sensor turns phone screen on and off automatically when calling.
  • Very fast and accurate GPS
  • Swype keyboard included free
  • Can be rooted.
  • Only Sprint app is SprintID. No junk.
  • Wireless hotspot capability
  • No notification light for SMS, Email, Missed Calls, etc.
  • No trackball. Made text editing a bit easier.
  • No light sensor. Screen brightness is fixed to your setting.
  • No dedicated dial and hang up button. Not really necessary on this phone.
  • Low-resolution 480x320 screen.
  • New Phone and Brand - No community for custom ROMs yet.
  • SprintID is confusing and an annoying addition.
  • The Google first time use wizards have been removed. I found these helpful as an experienced Android user and they were certainly helpful to new Android users.
  • I can't tell if the Google Backup facility is there. If I reset, will my apps automatically reinstall?
  • Included SD Card randomly mounts/remounts. I replaced mine with an 8GB and this problem has never occurred.
  • Can't set voicemail provider in settings. I tried to set it as Google Voice, but there's no option. So far this has had no functional drawbacks, but I like to do it "right".
Coming from a Hero, I can handle those drawbacks and gladly accept the improvements.

Wednesday, April 7, 2010

Android Widgets, the Lowest Common Denominator

I should be nicer, modern smartphones are meant to be intuitive and user friendly, but they're more powerful than ever and with that comes complexities. As such, some people just don't know how to use an Android widget. They see them, they may have even used them before, but they don't know how to use yours.

What am I talking about? If you've written a Widget only application for Android, you may have encountered some baffling negative feedback; users complaining that the application just doesn't work. In their defense, it might not entirely work. After downloading an application from the Market, the user may encounter an installation complete screen with a button to launch the newly downloaded application. In the latest versions of Android, if there's not an Activity defined to handle the MAIN intent, the button is grayed out. But in older versions, I've confirmed 1.5, that button is not grayed out. When the user clicks the button, an error is displayed.

Another way the user may encounter the same problem is from the notifications area. A notification is made indicating that the application installed successfully. When tapping on this notification the application is launched. Again, without a main activity, on older versions of Android, this will result in an error.

It may seem obvious to you that you've developed an application, and the user should add it to their home screen by pressing 'Menu' from the home screen and following the menus to add a widget. Unfortunately, it's not obvious to everyone. So here's the easy work-around. Create a basic layout with just a TextView. Fill the TextView with some instructions as to how a user should add the widget to their home screen. Extend Activity and create a dumb Activity class that sets the content view to the instruction layout. Finally, register this new Activity in your AndroidManifest as the consumer of the MAIN intent.

Instead of encountering an error, the user is confronted with obvious, yet helpful instructions. Hopefully you'll encounter a happier commenter as the result of these simple changes.

Thursday, April 1, 2010

San Francisco, CA Muni Bus Locator

The Muni Bus Locator allows you to stay inside until the bus is outside. Select a route, and the route, buses, and stops are drawn on an interactive map. Click a bus to see it's speed and status. Zoom in to see individual stops. Select a stop to see the predicted next arrivals. Press the menu button to select another route, or change map mode mode from Map to Satellite.

Search the Market for: Muni Locator

Or... Click/Scan the QR code below:

Monday, March 29, 2010

Avoiding ConcurrentModificationException in MapView.draw()

Throwing this out there because it may help someone. For whatever reason, you may have gotten the idea that you would like to add and remove Overlays to your MapView as you see fit. Problem is, that MapView may be iterating through that List when you pull the rug out from under it and remove something from that List. Adding is okay of course.

Here's my advice, don't ever remove from it. Just render it ineffective. You may find it best to just empty the collection that backs your ItemizedOverlay. Or override draw() and add a hook to return early without doing anything in a particular circumstance. Of course, to do any of this you'll need to maintain a handy reference to the Overlay you add.

So remember, it's okay to call mapView.getOverlays.add() at any time, but don't call mapView.getOverlays.remove(), because if the timing is off, it will blow up on you.

While I'm writing this, I was thinking, you may be able to call remove(), by first disabling your MapView. That's worth a shot if it works in your scenario.

ItemizedOverlay and ArrayIndexOutOfBoundsException

If you're working with Google's Maps API on Android, you've probably encountered an ArrayIndexOutofBoundsException in ItemizedOverlay. To recap, ItemizedOverlay is a useful implementation of Overlay that displays a set of items on the map. More often than not, your data is dynamic, and this set of items will grow or shrink over time. It may even be an empty set.

The ArrayIndexOutOfBounds exception is usually encountered because you've done one or more of the following:
  • Overlayitem getItem(int position) returns null in your ItemizedOverlay
  • The set of items is empty (related to above).
  • You're concurrently modifying your backing Collection of OverlayItems while the draw() method is iterating through them.
Let's quickly look at a solution for each one of these. The first is for you to solve. Why is it returning null? Debug your code.

I've read some crazy ideas about how to solve the 2nd problem, your backing collection is empty, and ItemizedOverlay pukes. This is very easy to workaround. Override the draw() methods, and return early. Here's an example:

public boolean draw(Canvas canvas, MapView mapView, boolean shadow,long when) {
if (myBackingList.isEmpty()) {
return false; // False means there's no need to immediately redraw.

Finally, it's important to know that when ItemizedOverlay is executing the draw() methods, it's actually looping through your Collection of OverlayItems by calling getItem() and size(). During this time it would be unwise to modify the collection. Your first instinct is probably to use a synchronized collection or call Collections.synchronizedList (or whichever is appropriate). But this probably won't help because ItemizedOverlay isn't calling the iterator on your collection, it doesn't know what your collection is. Instead, it's calling getItem(), N times.

The approach that works is to synchronize access to your collection in getItem(), size(), and and your call to super.draw(). Additionally, you'll need to synchronize wherever in your code you modify the collection.

So to wrap up, make sure you override draw() to handle the empty set scenario and synchronize access to your backing collection.

Good luck!

Wednesday, March 10, 2010

R-Line App without Ads

Just to prove that I'm not a full-on ad-whore, I've removed the ads from the R-Line. After all, it is for my home town. Enjoy!

Tuesday, February 23, 2010

R-Line App featured on New Raleigh blog

The New Raleigh blog was kind enough to mention the R-Line app in a story this week. Check out their blog post.


Break out the champagne, we've just made our first dollar in advertising. For you ad gurus, that's a Net eCPM of $2.42. I suppose it could be worse for a user base of about 100 mobile phones.

Monday, February 22, 2010

R-Line App Updates

What's New?
  • Directional bus markers
  • New stop markers
What's fixed?
  • Missing bus location data
  • Bus marker not centered over location
  • Moved ad to top to avoid zoom buttons occasionally overlapping ad.
  • Maintains map state (zoom, etc) when rotating device.

Monday, February 15, 2010

Generating Revenue with Ads

If you've downloaded my R-Line app, you'll instantly notice the somewhat obnoxious banner advertisement at the bottom. Actually, it's not that bad, if you're lucky enough to see an add from a more mainstream advertiser. I've seen a few tasteful and well done ads from Netflix, Dish Network, and others. Some of the ring-tone advertisements are unfortunately very ugly.

It's been a week since I published the R-Line app and it's time to give a quick assessment of what I've seen with respect to ad revenue. I had level expectations moving into this project. The R-Line app has a very limited audience. It's limited to people in the Raleigh, NC area, those of whom ride the downtown circular bus. That's typically downtown workers, bar hoppers, and bus drivers.

So how much coin did I rake in? 14 cents.

Here's a frame of reference for the interested. There's been roughly 100 downloads, and 50 people who've kept the app installed. Each day there's an average of 35 ad impressions (how many times a new ad showed), and I have seen a total of 12 clicks. Not too exciting, is it?

I have had questions about the low rate of keepers. Why have so many been quick to uninstall? The ad data helps reveal some answers. It appears there's plenty of people in Singapore, United Kingdom, Russia, and all other the world downloading the app. But why!? It's English only, and clearly states that the app is specific to Raleigh, NC. Who knows, either way, I expect these are the uninstallers.

I'm going to post the shameless "donation" version of the application, without advertisements. Let's see what that does.

Updates on the R-Line

I've made several improvements/bug fixes to the R-Line application. Here's some noteworthy changes:

I've changed my ItemizedOverlay for the moving buses to return false for draw(). I previously had it return true to force the maps API to redraw the overlays. The API docs tout this as a way to "animate" the layer. Unfortunately, this creates continuous drawing and high cpu usage. Instead, I created another listener to my data service to call the postInvalidate() on the MapView. This forces the map to redraw the overlays whenever new data is downloaded.

Also, within my ItemizedOverlay, I added some synchronizing to the data collection storing the buses. Inside draw(), we can't see it, but it's iterating over the collection. It's possible to call createItem(int i) on an item that no longer exists. This created a rare force close when panning/zooming the map and an overlay item disappeared. Using a Collections.synchronizedList() call to create a synchronized List was not enough. Instead I added some synchronizations to draw() and the method where I update the collection.

Monday, February 8, 2010

Building on the R-Line App

I've added two new features to the R-Line app. First, you can now select between Map, Map + Traffic, and Satellite map modes. I've also added a pop-up legend to help with identifying map markers. Touching the screen dismisses the legend.

Both features are accessible via the pop-up options menu by pressing the phone 'menu' button.

Sunday, February 7, 2010

R-Line App

I just published an application that displays real-time status of Raleigh, NC's downtown buses. Currently, Raleigh's monitoring is limited the R-Line route.

The two buses show up as black dots. Red markers are bus stops. The blue line is the primary route, and the red lines show the evening (after 6:30PM) modified routes.

The app was fun to create. It leverages web services, Google's Map APIs, and Quattro's advertisement APIs. Sorry about the ads, but I couldn't help myself to try it out. They should at least be occasionally targeted to the RDU market.

Data updates every 5 seconds, although the bus data is usually only updated from the buses every 30 seconds.

Future enhancements I hope to include click-able markers to display the stop name, bus name, etc.

Make sure you've upgraded to version 1.16 to ensure you continue to receive bus location updates.