Field Service Activity part

The goal of the FieldService Activity is to put the functions the mobile worker requires directly in front of him and make sure they are easy to access. A good mobile application is often one that can be used with one hand, such as the five-way navigation buttons, or in some cases a thumb tapping on a button. In addition, if there is helpful information to display, you should not hide it. It is helpful for our mobile worker to know that he is configured to obtain jobs from a particular server. Figure 12.6 demonstrates the Field Service Application conveying a very simple, yet easy-to-use home screen.

Before reviewing the code in FieldSer-vicejava, we need to take a break to discuss how the user and server settings are managed. This is important because these settings are used throughout the application, and as shown in the fieldservice.xml layout file, we need to access those values to display to our mobile worker on the home screen. PREFS CLASS

As you learned in chapter 5, there are a number of means for managing data. Because we need to persist this data across multiple invocations of our application, the data must be stored in a nonvolatile fashion. This application employs private SharedPreferences to accomplish this. Why? Despite the fact that we are largely ignoring security for this sample application, using private SharedPreferences means that other applications

com. msi.manning.UnleckingAndroid. Fields...

User: [email protected] Server:

Refresh job List

Manage Jobs

Figure 12.6 The home screen. Less is more.

cannot casually access this potentially important data. For example, we presently use only an identifier (let's call it an email address for simplicity) and a server URL in this application. However, we might also include a password or a PIN in a production-ready application, so keeping this data private is a good practice.

The Prefs class can be described as a helper or wrapper class. This class wraps the SharedPreferences code and exposes simple getter and setter methods, specific to this application. This implementation knows something about what we are trying to accomplish, so it adds value with some default values as well. Let's look at listing 12.4 to see how our Prefs class is implemented.

iPhone and iPad App Cash

iPhone and iPad App Cash

Discover how a single application could generate $1000's of dollars, instantly. The simple, low cost system for outsourcing app development to freelancers. How to quickly evaluate applications so you can create a high profit one of your very own. The fastest way to leverage the popularity of iPhone and iPad apps to skyrocket your income. Top methods for promoting your application for maximum exposure.

Get My Free Ebook

Post a comment