Software Tools

Various Android tools are at your disposal while you’re writing Android applications. The following sections outline some of the most popular tools to use in your day-to-day Android development process.

Internet

Thanks to the Internet capabilities of Android devices, users can find real-time information on the Internet, such as the next showing of a new movie or the next arrival of a commuter train. As a developer, you can have your apps use the Internet to access real-time, up-to-date data, such as weather, news, and sports scores, or (like Pandora and YouTube) to store your application’s icons and graphics.

technicalstuff.eps You can even offload your application’s more intense processes to a web server whenever appropriate, to save processing time or to streamline the app. In this well-established software architecture, known as client–server computing, the client uses the Internet to make a request to a server that’s ready to perform some work for your app. The built-in Maps app is an example of a client that accesses map and GPS data from a web server.

Audio and video support

Including audio and video in your apps is a breeze in the Android operating system. Many standard audio and video formats are supported, and adding multimedia content to your apps — such as sound effects, instructional videos, background music, and streaming video and audio from the Internet — couldn’t be easier. Be as creative as you want to be. The sky’s the limit.

Contacts

Your app can access a user’s Contacts list, which is stored on the device, to display the contact information in a new or different way or you can create your own Contacts list. You might even write an app that couples the contact information with the GPS system to alert the user whenever she’s near a contact’s address.

remember.eps Don’t use information from the Contacts list in a malicious way. Use your imagination, but be responsible about it. (See the next section “Security.”)

Security

Suppose that someone releases an app that sends a user’s entire Contacts list to a server for malicious purposes. For this reason, most functions that modify a user’s Android device or access its protected content need specific permissions. For example, if you want to download an image from the web, you need permission to use the Internet so that you can download the file to your device, and you need a separate permission to save the image file to an SD card. When your app is being installed, the user is notified of the permissions your app is requesting and can decide whether to proceed. Though asking for permission isn’t optional, it’s as easy as implementing a single line of code in your application’s manifest file. (Manifest files are described in Chapter 3.)

Google APIs

Users of the Android operating system aren’t limited to making calls, organizing contacts, or installing apps. As a developer, you have great power at your fingertips — you can even integrate maps into your application, for example. To do so, you use the Maps APIs that contain map widgets.

Pinpointing locations on a map

Perhaps you want to write an app that displays a user’s current location to friends. You can spend hundreds of hours developing a mapping system, or you can use the Android Maps API, which Google provides for use in your apps. You can embed the API in your application and you don’t have to invest hundreds of development hours or even a single cent. Using the Maps API, you can find almost anything that has an address. The possibilities are endless — a friend’s location, the nearest grocery store, or your favorite gas station, for example.

remember.eps

tip.eps Showing your current location to friends is cool, but the Android Maps API can also access the Google Navigation API, to pinpoint your location and show your users how to reach it.

Messaging in the clouds

Suppose that your application’s data is stored in the cloud (the Internet) and you download all its assets the first time it runs. And then you realize, after the fact, that an image is outdated. To update the image, the app needs to know that the image has changed. You can use the Google Cloud Messaging framework to send a cloud-to-device notification (a message from the web server to the device) to direct the app to update the image. This process works even if your app isn’t running. When the device receives the message, it dispatches a message to start your app so that it can take the appropriate action.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset