You are previewing Professional Android 4 Application Development, 3rd Edition.

Professional Android 4 Application Development, 3rd Edition

  1. Cover
  2. Chapter 1: Hello, Android
    1. A Little Background
    2. What Android Isn't
    3. Android: An Open Platform for Mobile Development
    4. Native Android Applications
    5. Android SDK Features
    6. Introducing the Open Handset Alliance
    7. What Does Android Run On?
    8. Why Develop for Mobile?
    9. Why Develop for Android?
    10. Introducing the Development Framework
  3. Chapter 2: Getting Started
    1. Developing for Android
    2. Developing for Mobile and Embedded Devices
    3. Android Development Tools
  4. Chapter 3: Creating Applications and Activities
    1. What Makes an Android Application?
    2. Introducing the Application Manifest File
    3. Using the Manifest Editor
    4. Externalizing Resources
    5. The Android Application Lifecycle
    6. Understanding an Application's Priority and Its Process' States
    7. Introducing the Android Application Class
    8. A Closer Look at Android Activities
  5. Chapter 4: Understanding Fragments
    1. Fundamental Android UI Design
    2. Android User Interface Fundamentals
    3. Introducing Layouts
    4. To-Do List Example
    5. Introducing Fragments
    6. The Android Widget Toolbox
    7. Creating New Views
    8. Introducing Adapters
  6. Chapter 5: Intents and Broadcast Receivers
    1. Introducing Intents
    2. Creating Intent Filters and Broadcast Receivers
  7. Chapter 6: Using Internet Resources
    1. Downloading and Parsing Internet Resources
    2. Using the Download Manager
    3. Using Internet Services
    4. Connecting to Google App Engine
    5. Best Practices for Downloading Data Without Draining the Battery
  8. Chapter 7: Files, Saving State,and Preferences
    1. Saving Simple Application Data
    2. Creating and Saving Shared Preferences
    3. Retrieving Shared Preferences
    4. Creating a Settings Activity for the Earthquake Viewer
    5. Introducing the Preference Framework and the Preference Activity
    6. Creating a Standard Preference Activity for the Earthquake Viewer
    7. Persisting the Application Instance State
    8. Including Static Files as Resources
    9. Working with the File System
  9. Chapter 8: Databases and Content Providers
    1. Introducing Android Databases
    2. Introducing SQLite
    3. Content Values and Cursors
    4. Working with SQLite Databases
    5. Creating Content Providers
    6. Using Content Providers
    7. Adding Search to Your Application
    8. Creating a Searchable Earthquake Content Provider
    9. Native Android Content Providers
  10. Chapter 9: Working in the Background
    1. Introducing Services
    2. Using Background Threads
    3. Using Alarms
    4. Using the Intent Service to Simplify the Earthquake Update Service
  11. Chapter 10: Expanding the User Experience
    1. Introducing the Action Bar
    2. Adding an Action Bar to the Earthquake Monitor
    3. Creating and Using Menus and Action Bar Action Items
    4. Refreshing the Earthquake Monitor
    5. Going Full Screen
    6. Introducing Dialogs
    7. Let's Make a Toast
    8. Introducing Notifications
    9. Adding Notifications and Dialogs to the Earthquake Monitor
  12. Chapter 11: Advanced User Experience
    1. Designing for Every Screen Size and Density
    2. Ensuring Accessibility
    3. Introducing Android Text-to-Speech
    4. Using Speech Recognition
    5. Controlling Device Vibration
    6. Working with Animations
    7. Enhancing Your Views
    8. Advanced Drawable Resources
    9. Copy, Paste, and the Clipboard
  13. Chapter 12: Hardware Sensors
    1. Using Sensors and the Sensor Manager
    2. Monitoring a Device's Movement and Orientation
    3. Introducing the Environmental Sensors
  14. Chapter 13: Maps, Geocoding, and Location-Based Services
    1. Using Location-Based Services
    2. Using the Emulator with Location-Based Services
    3. Selecting a Location Provider
    4. Finding Your Current Location
    5. Best Practice for Location Updates
    6. Using Proximity Alerts
    7. Using the Geocoder
    8. Creating Map-Based Activities
    9. Mapping Earthquakes Example
  15. Chapter 14: Invading the Home Screen
    1. Introducing Home Screen Widgets
    2. Creating App Widgets
    3. Creating an Earthquake Widget
    4. Introducing Collection View Widgets
    5. Introducing Live Folders
    6. Surfacing Application Search Results Using the Quick Search Box
    7. Creating Live Wallpaper
  16. Chapter 15: Audio, Video, and Using the Camera
    1. Playing Audio and Video
    2. Manipulating Raw Audio
    3. Creating a Sound Pool
    4. Using Audio Effects
    5. Using the Camera for Taking Pictures
    6. Recording Video
    7. Using Media Effects
    8. Adding Media to the Media Store
  17. Chapter 16: Bluetooth, NFC, Networks, and Wi-Fi
    1. Using Bluetooth
    2. Managing Network and Internet Connectivity
    3. Managing Wi-Fi
    4. Transferring Data Using Wi-Fi Direct
    5. Near Field Communication
  18. Chapter 17: Telephony and SMS
    1. Hardware Support for Telephony
    2. Using Telephony
    3. Introducing SMS and MMS
    4. Introducing SIP and VOIP
  19. Chapter 18: Advanced Android Development
    1. Paranoid Android
    2. Introducing Cloud to Device Messaging
    3. Implementing Copy Protection Using the License Verification Library
    4. Introducing In-App Billing
    5. Using Wake Locks
    6. Using AIDL to Support Inter-Process Communication for Services
    7. Dealing with Different Hardware and Software Availability
    8. Optimizing UI Performance with Strict Mode
  20. Chapter 19: Monetizing, Promoting, and Distributing Applications
    1. Signing and Publishing Applications
    2. Distributing Applications
    3. An Introduction to Monetizing Your Applications
    4. Application Marketing, Promotion, and Distribution Strategies
    5. Analytics and Referral Tracking
  21. Introduction
  22. Advertisements

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, ...

The best content for your career. Discover unlimited learning on demand for around $1/day.