E-Book, Englisch, 480 Seiten
Baxter-Reynolds Multimobile Development
1. ed
ISBN: 978-1-4302-3199-8
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Building Applications for the iPhone and Android Platforms
E-Book, Englisch, 480 Seiten
ISBN: 978-1-4302-3199-8
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
You've developed a killer app for one mobile device-now it's time to maximize your intellectual investment and develop for the full spectrum of mobile platforms and devices. With Cracking iPhone and Android Native Development, you'll learn how to quickly retool between the iPhone and Android platforms and broaden the interest and audience of your app, without working with burdensome and error-prone compatibility layers and toolkits. Cracking iPhone and Android Native Development takes you, the developer, through the same mobile software development project on both platforms, learning the differences between and the relative strengths and weaknesses of each platform as you go. No magic intermediate layers of obfuscation-by the time you get to the end, you'll be an expert at developing for any of the major smartphone platforms using each vendor's preferred toolset and approach. Cracking iPhone and Android Native Development covers the iPhone and Android platforms, two of the hottest mobile device platforms on the market today.
Matthew Baxter-Reynolds is a software development consultant, working with companies to improve their products and capability as software developers. Between 2000 and 2003, he wrote a considerable amount of content on Windows .NET and Windows DNA technologies for Wrox Press, including a best-selling book, Beginning E-commerce. He also acts as chief technical officer to Simplehosted, a leading provider of mobile workforce management solutions in the U.K. Their solutions are based on Windows Mobile.
Autoren/Hrsg.
Weitere Infos & Material
1;Title page ;1
2;Copyright page ;2
3;Contents at a Glance;4
4;Table of contents ;5
5;About the Author;11
6;About the Technical Reviewer;12
7;Acknowledgments;13
8;CHAPTER 1 Introduction;14
8.1;What’s the Purpose of This Book?;15
8.2;How Is This Book Structured?;15
8.3;Where Can You Get Help and Support?;17
8.4;Conclusion;17
9;CHAPTER 2 The Six Bookmarks Server Service;18
9.1;Creating an API Account;18
9.1.1;Creating a User;19
9.2;The Users Service;21
9.2.1;REST ful Web Services;21
9.2.2;Testing the Calls;22
9.2.3;Examining Logon Operations;22
9.2.3.1;Obtaining a Token;23
9.2.3.2;Logging On the User;24
9.2.3.3;Cleaning Up;24
9.3;The Bookmarks Service;25
9.3.1;Adding Some Test Data;25
9.3.2;Working with OData;26
9.3.3;OData Queries;30
9.3.4;Issuing Updates over OData;31
9.3.5;Constraining Data to the Logged-On User;31
9.4;Conclusion;31
10;CHAPTER 3 Application Architectureand Functional Specification;32
10.1;A Word About Slates;32
10.2;Functional Specification;32
10.2.1;Logging On;33
10.2.2;Synchronizing;33
10.2.3;Navigator;34
10.2.4;Configuring Bookmarks;35
10.2.5;Configuring a Single Bookmark (“Configure Singleton”);36
10.2.6;Missing Functionality;36
10.3;Application Architecture and Technical Specification;37
10.3.1;Approach;37
10.3.2;Object-Relational Mapping;38
10.3.2.1;Metadata;38
10.3.2.2;Entities;39
10.3.2.3;Generating Entities;40
10.3.2.4;SQL Statements;41
10.3.2.5;Change Processors;42
10.3.3;Server Communication;42
10.3.4;Technical Approach Broken Down by Platform;43
10.3.4.1;Core Toolset;44
10.3.4.2;Issue HTTP Requests;44
10.3.4.3;Read XML Document (Including Reading OData Results);45
10.3.4.4;Write an XML Document;45
10.3.4.5;Maintain a Local Store;46
10.4;Conclusion;46
11;CHAPTER 4 Android: Installing the Toolset;47
11.1;Why Android First?;47
11.2;Installing the Toolset;47
11.2.1;Installing Java;47
11.2.2;Installing Eclipse;48
11.2.3;Installing the Android SDK;48
11.2.3.1;Bug in the “r05” Installer;48
11.2.4;Installing the Android Development Tools (ADT) into Eclipse;49
11.3;Configuring the Emulator;53
11.4;Creating Our Android “Hello, World” Application;56
11.4.1;Saying “Hello, World”;59
11.4.2;Declarative Layout;59
11.4.3;Wiring Up the Button;61
11.5;Conclusion;66
12;CHAPTER 5 Android: Building the Logon Formand Consuming REST Services;67
12.1;Creating the Project;67
12.2;Conventions for Presenting Code;68
12.3;Calling RESTful Services;69
12.3.1;Issuing Web Requests;69
12.3.1.1;The “DownloadSettings” Class;70
12.3.1.2;The “Download” and “DownloadXml” Methods;70
12.3.1.3;Extra Methods on “HttpHelper”;73
12.3.2;Authenticating Our API Account;74
12.3.2.1;The “LogonResponse”;76
12.3.2.2;Building the “XmlHelper” Class;77
12.3.2.3;Creating the “Logon” Method on the API Service;81
12.3.2.4;Wiring Up “EnsureApiAuthenticated”;84
12.3.3;Authenticating the User via “UsersService”;85
12.3.4;Setting “Allow Internet Access” Permission;86
12.4;Creating the Logon Form;87
12.4.1;Model/View/Controller;91
12.4.1.1;Contexts and Building the Controller;91
12.4.1.2;Binding the View and Controller;94
12.4.2;Logging On;98
12.4.3;“Remember Me”;101
12.5;Conclusion;103
13;CHAPTER 6 Android: An ORM Layeron SQLite;104
13.1;SQLite on Android;104
13.2;Entities;104
13.2.1;“EntityType”;105
13.2.2;Creating the Basic “Entity” Class;111
13.2.3;Setting Values in an Entity;113
13.2.4;Building “Bookmark”;118
13.2.5;Registering the “EntityType”;120
13.3;Displaying Some Fake Bookmarks;121
13.3.1;Creating the Form;121
13.3.1.1;Creating the “Navigator.xml” Layout;122
13.3.1.2;Creating the Controller;124
13.3.1.3;Creating the View Interface;125
13.3.1.4;Creating the Navigator Activity;126
13.3.2;Showing the Bookmarks;128
13.3.2.1;Adding the Activity to the Manifest;131
13.3.2.2;Issuing the “Go to Navigator” “Intent”;131
13.3.3;Wiring Up the Bookmarks;133
13.4;Building the “Sync” Class;135
13.4.1;Calling the Server’s Bookmarks OData Service;135
13.4.1.1;Namespaces;136
13.4.1.2;Adding Functionality to “XmlHelper”;137
13.4.1.3;Querying the Feed;138
13.4.1.4;Creating Entities from Name/Value Collections;142
13.4.2;Managing the Database;143
13.4.3;The “SqlStatement” Class and “ISqlStatementSource” Interface;145
13.4.4;Creating Tables;146
13.4.5;Examining the Database with Sqliteman;150
13.4.6;Writing Bookmarks to the Database;154
13.4.6.1;Building the Change Processor;154
13.4.6.2;Inserting Entities;155
13.4.6.3;Downloading Bookmarks;157
13.4.7;Reading Bookmarks and Displaying Them on the Navigator;159
13.4.7.1;Executing the Entity Collection;161
13.4.7.2;Asking the Navigator Controller to Load the Real Bookmarks;163
13.5;Conclusion;164
14;CHAPTER 7 Android: Pushing Changesto the Server;165
14.1;Capturing Local Changes;165
14.1.1;Constraining SQL Filters;165
14.1.2;Excluding Deleted Entities from the View;171
14.1.3;Getting a Bookmark by Ordinal;172
14.1.4;Building the Configuration Form;173
14.1.4.1;List Views;173
14.1.4.2;Binding List Data;178
14.1.4.3;Handling Menu Actions;188
14.1.4.4;Creating the Context Menu;190
14.1.5;Configuring Singletons;196
14.2;Pushing Changes to the Server;204
14.2.1;Detecting Local Changes;204
14.2.1.1;Building the “PushUpdates” Method;204
14.2.2;Issuing Server Requests to Insert, Update, and Delete;208
14.2.3;Update via “HTTP MERGE” and Insert via “HTTP POST”;209
14.2.3.1;The “ODataOperation” Enumeration;209
14.2.4;Marking Fields As Being Available on the Server;209
14.2.4.1;Building the XML;211
14.2.4.2;Building “ExecuteODataOperation”;214
14.3;Conclusion;219
15;CHAPTER 8 iOS: Installing the Toolset;220
15.1;iPad Development;220
15.2;Installing Xcode;220
15.3;An Objective-C Primer for .NET and Java Developers;220
15.3.1;Problems with Objective-C;221
15.3.2;Calling Methods (aka “Sending Messages”);222
15.3.2.1;Creating the Project;222
15.3.3;Properties (and a Little Memory Management);224
15.3.3.1;A Little More about Memory Management;229
15.3.4;Methods;230
15.3.5;Namespaces;232
15.3.6;The Biggest Gotcha in Objective-C;232
15.4;“Hello, World” for iPhone;232
15.4.1;Building the User Interface;234
15.4.2;Creating a Windows and Showing the View;241
15.4.2.1;Displaying the Message Box;242
15.5;Conclusion;244
16;CHAPTER 9 iOS: Building the Logon Formand Consuming REST Services;245
16.1;Creating the Project;245
16.2;Creating the Logon Form;245
16.2.1;Creating the Logon Form User Interface;247
16.2.2;Showing the Logon Form;250
16.2.3;Special Note About Grouped Views;254
16.3;Conventions for Presenting Code in the iPhone Chapters;254
16.4;Calling the Services;255
16.4.1;Capturing the Logon Request;255
16.5;Calling the API Service;260
16.5.1;Building the Proxy Classes;261
16.5.1.1;The SBHttpHelper and SBDownloadBucket Classes;262
16.5.1.2;Implementing SBDownloadBucket;265
16.5.1.3;Making a Real Call to the API Service and Parsing the XML;271
16.5.2;Calling the Users Service;289
16.5.3;Notifying That Work Is in Progress;295
16.6;Conclusion;297
17;CHAPTER 10 iOS: An ORM Layer on SQLite;298
17.1;A Note About Content That Has Already Been Covered;298
17.2;Entities;298
17.2.1;The SBEntityType Class;299
17.2.2;The SBEntity Class;307
17.2.3;Setting Values in an Entity;310
17.2.4;Building SBBookmark;315
17.2.5;Creating SBEntityType Instances;318
17.3;Displaying Some Fake Bookmarks;320
17.3.1;Creating the View;320
17.3.2;Building the View Engine;324
17.3.3;Displaying Bookmarks;329
17.3.4;Handling Navigation;332
17.4;Building the Sync Class;334
17.4.1;Calling the Server’s Bookmarks OData Service;334
17.4.1.1;Namespaces;336
17.4.1.2;Querying the Feed;336
17.4.1.3;Stubbing SBSync;339
17.4.1.4;Parsing the XML;343
17.4.1.5;Spinning the Progress Wheel;350
17.4.2;Database Operations;351
17.4.2.1;Including SQLite;351
17.4.3;Building SBDBHelper and Implementing Error Handling;354
17.4.3.1;Defining SQL Statements;356
17.4.3.2;Creating Tables;358
17.4.3.3;Storing the Database in the Correct Location;367
17.4.4;Writing Bookmarks to the Database;368
17.4.4.1;Building the Change Processor;368
17.4.4.2;Completing getLatest;373
17.4.4.3;Reading Bookmarks and Displaying Them on the Navigator;375
17.5;Conclusion;387
18;CHAPTER 11 iOS : Pushing ChangesBack to the Server;388
18.1;Configuring Bookmarks;388
18.1.1;Putting Data on the Table;391
18.1.2;Sorting the Bookmarks;394
18.1.3;Singleton View;395
18.1.4;Editing a Bookmark;400
18.1.4.1;Capturing and Committing Changes;403
18.1.5;Implementing the Delete Method;407
18.1.6;Adding a Bookmark;408
18.1.7;Deleting Bookmarks;410
18.1.8;Manually Syncing;413
18.2;Pushing Changes to the Server;414
18.2.1;Work Items;417
18.2.2;Issuing OData Change Requests;423
18.2.3;Flagging Fields As “Not on Server”;424
18.2.4;Issuing Requests;425
18.2.4.1;Implementing executeODataOperation;429
18.2.5;Modifying processWorkItems;431
18.3;Conclusion;433
19;CHAPTER 12 iOS: MonoTouch;434
19.1;Mono in the Big Picture;434
19.2;Chapter Structure;435
19.3;Installing MonoTouch;435
19.4;“Hello, World”;436
19.4.1;Inspecting the Code-Behind;439
19.4.2;Wiring Up the Button;441
19.4.3;Running the Project;442
19.5;Calling the Six Bookmarks API RESTful Service;443
19.5.1;Creating the Project;443
19.5.2;Building ServiceProxy Et Al.;444
19.5.3;Calling the Service Method;449
19.6;Conclusion;453
20;Index;454




