Summary This chapter certainly was not short, but hopefully it was worth the read. The intent of

12.6 Summary This chapter certainly was not short, but hopefully it was worth the read. The intent of

the sample application was to tie together many things learned in previous chapters into a composite application that has real-world applicability to the kind of uses an Android device is capable of bringing to fruition. Is this sample application produc- tion ready? Of course not, but almost! That is, as they say, an exercise for the reader.

Starting with a simple splash screen, this application demonstrated the use of Han- dler s and displaying images stored in the resources section of an Android project. Moving along to the main screen, a simple UI led to different activities useful for launching various aspects of the realistic application.

Communications with the server downloaded XML data, while showing the user a ProgressDialog along the way. Once the data stream commenced, the data was parsed by the SAX XML parser, using a custom Handler to navigate the XML document.

Managing jobs in a ListView was demonstrated to be as easy as tapping on the desired job in the list. The next screen, the ShowJobs Activity, allowed even more functionality with the ability to jump to a Map showing the location of the job and even

a specific product information page customized to this job. Both of those functions were as simple as preparing an Intent and a call to startActivity(). Once the mobile technician completed the job in the field, the CloseJob Activ- ity brought the touch-screen elements into play by allowing the user to capture a sig- nature from his customer. That digital signature was then stamped with additional, contextual information and transmitted over the internet to prove the job was done! Jumping back to what you learned earlier, it would be straightforward to add location- based data to further authenticate the captured signature.

The chapter wrapped up with a quick survey of the server-side components to demonstrate some of the steps necessary to tie the mobile and the server sides together.

340

C HAPTER 12 Putting it all together–the Field Service Application

The sample application is hosted on the internet and is free for you to test out with your own Android application, and of course the full source code is provided for the Android and server applications discussed in this chapter.

Now that we have shown what can be accomplished when exercising a broad range of the Android SDK, the next chapter takes a decidedly different turn as we explore the underpinnings of Android a little deeper and look at building native C applica- tions for the Android platform.

Hacking Android

This chapter covers:

Android’s Linux foundation

Building a C application

Using the SQLite database from C

Bridging the gap with a Java client application

This book has presented a cross section of development topics in an effort to unlock the potential of the Android platform for the purpose of delivering useful, and perhaps even fun, mobile applications. In chapter 12 we built a more compre- hensive application, building on what was introduced in the prior chapters. As we embark on this final chapter, we are leaving behind the comforts of working strictly in the Android SDK, Java, and Eclipse.

The Android SDK is quite comprehensive and capable, as this book has attempted to convey, but there may be times when your application requires some- thing more. This chapter explores the steps required to build applications that run in the Linux foundation layer of Android. To accomplish this, we are going to use the C programming language. In this chapter we use the term Android/Linux to refer to the Linux underpinnings of the Android platform. We also use the term Android/Java to refer to a Java application built using the Android SDK and Eclipse.

C HAPTER 13 Hacking Android

We demonstrate the steps of building an Android/Linux application commencing with a description of the environment and the required tool chain. After an obligatory Hello World–caliber application, we construct a more sophisticated application that implements a daytime server. Ultimately any application built for Android/Linux needs to bring value to the user in some form. In an effort to meet this objective, it is desirable that Android/Java be able to interact in a meaningful manner with our Android/Linux application. To that end we will build a traditional Android applica- tion using Java in Eclipse to interact with the Android/Linux server application.

Let’s get started with an examination of the requirements of building our first C application for Android.