Chapter 6

Using Internet Resources

What's in this Chapter?

Connecting to Internet resources

Parsing XML resources

Using the Download Manager to download files

Querying the Download Manager

Using the Account Manager to authenticate with Google App Engine

This chapter introduces Android's Internet connectivity model and some of the Java techniques for parsing Internet data feeds. You'll learn how to connect to an Internet resource and how to use the SAX Parser and the XML Pull Parser to parse XML resources.

An earthquake-monitoring example will demonstrate how to tie together all these features, and forms the basis of an ongoing example that you'll improve and extend in later chapters.

This chapter introduces the Download Manager, and you learn how to use it to schedule and manage long-running downloads. You'll also learn how to customize its notifications and query the Downloads Content Provider to determine the status of your downloads.

Finally, this chapter introduces how to use the Account Manager to make authenticated requests from Google App Engine backends.

Downloading and Parsing Internet Resources

Android offers several ways to leverage Internet resources. At one extreme you can use a WebView to include a WebKit-based browser within an Activity. At the other extreme you can use client-side APIs, such as the Google APIs, to interact directly with server processes. Somewhere in between, you can process remote XML feeds to extract and process data using a Java-based XML parser, ...

Get Professional Android 4 Application Development, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.