8

Working with Data

WHAT YOU WILL LEARN IN THIS CHAPTER:

  • Implementing network detection
  • Handling changes in network availability
  • Monitoring URL requests
  • Exploring SQLite operations
  • Utilizing databases and tables

In this chapter you'll build a Flex mobile example utilizing SQLite, and incorporate the concept of saving Formula 1 racing team data to a database. If you don't know much about Formula 1, don't worry; you'll just be referencing a database of basic team data.

The data created by the application will be modifiable on the mobile device, so you will be able to create a team and add drivers, update the values, and remove them from the database, directly from the app.

SQL provides an avenue for creating mobile applications with self-contained data using Adobe AIR. You need to take a number of steps to open a database stored on the device and you should take a look at these first.

You'll begin in this chapter by implementing network detection, and learning how you can retrieve data over an available Internet network.

DETECTING CHANGES IN NETWORK AVAILABILITY

It's important to have a backup when working with online data services. It's also useful for the user to know what the status is when a network service changes.

Retrieving Data with URLRequest

You request remote data via an HTTP URL path through using the URLRequest and URLLoader classes. Both classes are found in the flash.net package and need to be imported in ActionScript mobile projects, as shown in the following snippet: ...

Get Beginning Flash®, Flex®, and AIR® Development for Mobile Devices 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.