The Connected World

Over the next few chapters, we'll cover more advanced topics such as network access and location-based services. You can write many useful applications without these features, but going beyond the basic features of Android will really help you add value to your programs, giving them much more functionality with a minimum of effort.

What do you use your mobile phone for? Aside from making calls, more and more people are using their phones as mobile Internet devices. Analysts predict that in a few years mobile phones will surpass desktop computers as the number-one way to connect to the Internet.1 This point has already been reached in some parts of the world.2

Android phones are well equipped for the new connected world of the mobile Internet. First, Android provides a full-featured web browser based on the WebKit open source project.3 This is the same engine you will find in Google Chrome, the Apple iPhone, and the Safari desktop browser but with a twist. Android lets you use the browser as a component right inside your application.

Second, Android gives your programs access to standard network services like TCP/IP sockets. This lets you consume web services from Google, Yahoo, Amazon, and many other sources on the Internet.

1. http://archive.mobilecomputingnews.com/2010/0205.html

2. http://www.comscore.com/press/release.asp?press=1742

3. http://webkit.org

5:30 PM

Figure 7.1: Opening a browser using an Android intent

In this chapter, you'll learn how to take advantage of all these features and more through four example programs:

• BrowserIntent: Demonstrates opening an external web browser using an Android intent

• BrowserView: Shows you how to embed a browser directly into your application

• LocalBrowser: Explains how JavaScript in an embedded WebView and Java code in your Android program can talk to each other

• Translate: Uses data binding, threading, and web services for an amusing purpose

0 0

Post a comment