One of the great promises of Android mobile phones is their ability to run applications that enhance opportunities for social networking between users. This promise echoes the reality of the Internet. The first generation of Internet applications were about user access to information, and many of those applications have been very popular. The second wave of Internet applications has been about connecting users to each other. Applications such as Facebook, YouTube, and many others enhance our ability to connect with people of similar interests, and allow the application's users to provide some or all of the content that makes the application what it is. Android has the potential to take that concept and add a new dimension: mobility. It's expected that a whole new generation of applications will be built for users of mobile devices: social networking applications that are easy to use while walking down the street; applications that are aware of the user's location; applications that allow the easy sharing of content-rich information, such as pictures and videos.
As mentioned in the previous chapter, we are going to study just such an application as an example of Android application development. The code is available for you to download from the book's website (http://www.oreilly.com/catalog/9780596521479), and is based on an actual entry in the first round of the Android Developer Challenge, sponsored by Google. The application is an example of a class of applications known as "friend finders" because that's the central idea.
In the case of the MicroJobs application, instead of finding friends, the user is trying to locate a temporary job in the vicinity, so she can work for a few hours and make some money. The premise is that employers looking for temporary help have entered available jobs, descriptions, hours, and offered wages in a web-based database that is accessible from Android mobile phones. Anyone looking for a few hours' work can use the MicroJobs application to access that database, look for jobs in the immediate area, communicate with friends about potential employers and potential jobs, and call the employer directly if she is interested in the position. For our purposes here, we won't create an online service; we'll just have some canned data on the phone. The application has a number of features that extend that central idea in ways that are unique to mobile handsets:
The Android mobile phone environment provides very rich support for dynamic, interactive maps, and we're going to take full advantage of its capabilities. You'll see that with very little code, we'll be able to show dynamic maps of our local neighborhood, getting location updates from the internal GPS to automatically scroll the map as we move. We'll be able to scroll the map in two directions, zoom in and out, and even switch to satellite views.
A graphic overlay on the map will show us where jobs are placed in the area, and will allow us to get more information about a job by just touching its symbol on the map. We will access Android's Contact Manager application to get address information for our friends (telephone numbers, instant messaging addresses, etc.), and access the MicroJobs database to get more information about posted jobs. Instant messaging
When we find friends we want to chat with, we will be able to contact them via instant messages (IMs), by trading SMS messages with our friends' mobile phones.
Talking with friends or employers
If IMing is too slow or cumbersome, we'll be able to easily place a cellular call to our friends, or call the employer offering a job.
Figure 3-1. MJAndroid opening screenshot Browsing the Web
Most employers have an associated website that provides more detailed information. We'll be able to select an employer off a list or off the map and quickly zero in on their website to find out, for example, what the place looks like.
This is a fun application that could easily be developed further into a full-blown service, but our intent in this book is to show you just how easy it is to develop and combine these powerful capabilities in your own application. The complete source code for the application is available to you on the book's website, and we will refer to it frequently throughout this book. Although it's not absolutely required in order to understand the material in the book, you are strongly encouraged to download the source to your own computer. That way, you'll have it readily available for reference, and it will be easy to copy sections of code and paste them into your own applications as you move on.
Figure 3-1 shows the screen displayed by MJAndroid when you first run it. It's a map of your local area, overlaid with a few buttons and pins.
Was this article helpful?