O'Reilly logo

BlackBerry Hacks by Dave Mabe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #50. Find Your Way with a GPS

Use the BlackBerry 7520 to get driving directions and location-based services.

With the BlackBerry's constant network connectivity and portability, it was only a matter of time before RIM introduced a device with a Global Positioning System (GPS). The 7520 from Nextel has a GPS chip that can be accessed by developers of third-party applications to create location-based services. TeleNav (http://www.telenav.com) is a product by TeleNavigation and is first out of the gate with a great offering for any GPS and BlackBerry enthusiast.

TeleNav can help you navigate to a particular address or airport by speaking the directions as you drive! You can also use it to find certain businesses within driving distance of your current location, wherever that may be. Once you select a local business, you can easily instruct TeleNav to calculate the optimal route to get there and give you directions as you drive. This excellent service costs $29.99 a month, and can be billed right to your Nextel monthly bill.

Get Started with TeleNav

When you start TeleNav, you will be asked for your username and password to log onto the service. Your username will be your phone number on the device. Your BlackBerry will sense that a program is trying to access the GPS chip, and will ask whether you'd like to allow the access. This setting can be controlled by going to Options Location Based Services and setting the Privacy Setting option to Unrestricted.

Once you've logged into TeleNav (see Figure 4-51), you can use the main screen to select the icon that reads "View a map around an address." You can choose from a variety of locations, including "Here," meaning wherever you happen to be at the moment. Use the Enter key to select Here. TeleNav reads the GPS chip to get the current location and then uses your BlackBerry's TCP connection to communicate with its servers to retrieve the map given your current coordinates. A road map is displayed along with your current coordinates, as shown in Figure 4-52. You can use the U, N, K, and H keys to move around on the map and the number keys to set the zoom level.

TeleNav main screen

Figure 4-51. TeleNav main screen

Mapping an address in TeleNav

Figure 4-52. Mapping an address in TeleNav

Navigate to an Address

From the main TeleNav screen, choose the Real-Time GPS Navigation icon to navigate to an address. There are a variety of ways to enter the address to which you'd like to go. You can enter an address on your BlackBerry, or even call in the address to an automated attendant (so you don't have to type anything!). TeleNav verifies the address by doing a live lookup and retrieves the GPS coordinates of the location you entered. You can also use the personalized section of http://www.telenav.com to enter addresses on your desktop computer to plan a trip ahead of time.

After TeleNav performs the lookup, verify the destination and choose Get route, and then select Start from here. TeleNav accesses your GPS and communicates with its server to determine the best route to take to get to your destination. Once the route is determined, TeleNav puts you in a navigation screen that shows the current road you're on, the next road you should turn onto, the distance until your next turn, the total trip distance, and the total trip time at your current rate (see Figure 4-53).

As you approach your next turn, TeleNav uses a text-to-speech engine that speaks the directions through the Direct Connect speaker on the device.

Navigation mode

Figure 4-53. Navigation mode

You'll hear it say "Prepare to turn right onto Jones Ferry Road in .3 miles" or "Veer right and merge onto Interstate 40 west bound." Because of the text-to-speech function, you won't even have to look at your device—just keep it parked in the passenger seat. If you do look at your device, you'll see nice and accurate arrow icons showing the type of turn you'll be making next. If the next turn is a 90 degree angle, you'll see an arrow indicating it. If the intersection isn't a right angle, you'll see an icon depicting the direction and angle of the turn—quite useful information for some of the hairy turns you might come across in an unfamiliar location.

If (when) you get off the route that TeleNav has selected, there is an audible double beep, followed by a voice saying "New Route." TeleNav senses you are off course and re-calculates the route. The new route could be a completely new set of driving directions or the first turn could be "Do a U-turn" to get you back on the original route—it all depends on your whereabouts and your proximity to your destination.

Find the Closest Coffee Shop

Have you ever been in a new place and needed a good cup of coffee? I've been in that situation plenty of times and would have paid good money for this feature. TeleNav lets you look up the closest businesses to your current coordinates by type! Go to the Find a Business icon from the main TeleNav screen and select a search point. The most common search point is "Here," but you can also choose a search point from any waypoint you've created or any recent destination. You can also simply enter an address for your search point. You can look up coffee shops, ATMs, restaurants by cuisine, or the closest bed and breakfast. You can even search for gas stations by price per gallon! There is a lengthy list of business types to choose from, and the results are sorted by distance from your search point (probably your current location). You can easily navigate to any of the results with just a couple clicks, as shown in Figure 4-54.

Mmmm…coffee

Figure 4-54. Mmmm…coffee

Warning

The TeleNav program is very hard on the battery; simply leaving the main screen up on your BlackBerry will access the GPS chip and drain your battery very quickly. Be sure and exit the TeleNav program when you are not using it.

Imagine the Places You'll Go

It only takes a little bit of imagination to invent all sorts of cool tricks to do with a GPS-enabled BlackBerry. For example, imagine a custom application that accesses the GPS coordinates at time periods configurable by the user. It could communicate with a web service over HTTP [Hack #94] and upload a custom trip name, username, timestamp, and latitude and longitude coordinates. Using the Google Maps API (http://www.google.com/apis/maps/), you could code a web site to map the course of your various trips. The user could set the upload interval to a very small interval for short trips or a much longer interval for extended trips. The program could release control of the GPS between intervals to conserve the battery. The user could send a URL for the trip for others to view. ("Hey, Mom, click here to view the progress of our family vacation in real time. Here's the username and password.")

With all the press that maps and location-based services have been getting recently, having a GPS on your BlackBerry opens up some impressive possibilities for developers.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required