SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Teaches all that students need to learn to create and publish apps in BOTH the Google Play store for Android and Apple's App Store for iOS (iPhone, iPad)!
The Only Tutorial Covering BOTH iOS and Android—for students and professionals alike!
Now, one book can help you master mobile app development with both market-leading platforms: Apple’s iOS and Google’s Android. Perfect for both students and professionals, Learning Mobile App Development is the only tutorial with complete parallel coverage of both iOS and Android. With this guide, you can master either platform, or both—and gain a deeper understanding of the issues associated with developing mobile apps.
You’ll develop an actual working app on both iOS and Android, mastering the entire mobile app development lifecycle, from planning through licensing and distribution.
Each tutorial in this book has been carefully designed to support readers with widely varying backgrounds and has been extensively tested in live developer training courses. If you’re new to iOS, you’ll also find an easy, practical introduction to Objective-C, Apple’s native language.
All source code for this book, organized by chapter, is available at https://github.com/LearningMobile/BookApps
Coverage includes
Learning Mobile App Development: Using Eclipse for Android Development
Download the sample pages (includes Chapters 3 and 9 and Index)
Preface xiv
Part I Overview of Mobile App Development 1
1 Why Mobile Apps? 3
Transformative Devices 3
Reaching Customers 4
Changing Business Process 6
Making Money 9
Summary 10
Exercises 10
2 App Design Issues and Considerations 13
App Design 13
Operating System Design Issues 13
Screen Size and Orientation Issues 17
Connectivity Issues 18
Battery Issues 19
Hardware Issues 19
Device Differences 21
Android 21
iOS 23
Introducing Your First App 23
Contact Screen 24
Contact List Screen 24
Map Screen 25
Settings Screen 26
Summary 26
Exercises 27
Part II Developing the Android App 29
3 Using Eclipse for Android Development 31
Starting a New Project 31
Setting Up the Workspace 32
Creating the Project 32
Components of the IDE 35
The Android Manifest 37
Configuring the Emulator 39
Coding the Interface 42
Coding App Behavior 50
Adding Code 52
Summary 54
Exercises 54
4 Android Navigation and Interface Design 55
Activities, Layouts, and Intents 55
The Activity Class 56
Layout 56
Intents 57
Creating the Interface 57
Create the Project 58
Create the Navigation Bar 59
Create the Contact Layout 64
Activating the Interface 78
Code the Navigation Bar 78
Code the Toggle Button 80
Code the DatePicker Dialog 82
Summary 86
Exercises 87
5 Persistent Data in Android 89
Preferences, Files, and Database 89
Preferences 89
Files 90
Database 90
Creating the Database 91
Create the Database Helper Class 91
Create the Data Source Class 93
Using the Database 98
Capture User-Entered Data 99
Save User-Entered Data 101
Use the Debugger 105
Using Preferences 107
Create the Settings Layout 107
Code the Page’s Behavior 109
Summary 113
Exercises 114
6 Lists in Android: Navigation and Information
Display 115
Lists and Adapters 115
Lists 115
Adapters 116
Simple Lists 116
Create the Data Source Method 116
Create the Layout 118
Code the Activity 118
Complex Lists 121
Create the Data Source Method 121
Create the Layout 123
Create the Custom Adapter 125
Code the Activity 127
Add Delete Functionality 128
Completing the ContactList Activity 135
Populating the ContactActivity Screen 135
Coding the Add Button 138
Sort the Contacts List 139
Set ContactListActivity as the Default Activity 141
Set ContactActivity as Default Activity with no
Contacts in Database 142
Summary 143
Exercises 143
7 Maps and Location in Android 145
Location Sensors, Maps, and Fragments 145
Location Sensors 145
Maps 146
Fragments 146
Setting Up for Maps 146
Passing Data Between Controllers 151
Finding Your Location 152
Geocoding: Get Coordinates from an Address 152
Get Coordinates from the GPS Sensor 155
Get Coordinates from Network Sensor 159
Get Coordinates from the Map 161
Displaying Your Contacts’ Locations 164
Summary 170
Exercises 171
8 Access to Hardware and Sensors in Android 173
Sensors, Managers, and Other Hardware 173
Sensors 173
Managers 174
Other Hardware 174
Monitoring the Battery 174
Using Sensors to Create a Compass 177
Using the Phone 181
Using the Camera 183
Summary 189
Exercise 190
Part III Developing the iOS App 191
9 Using Xcode for iOS Development 193
Creating the Xcode Project 193
Project Settings 196
Creating the User Interface 199
Running the App in the Simulator 200
Adding App Behavior 202
Dismissing the Keyboard 205
App Icons and Launch Images 208
Summary 211
Exercises 211
10 iOS Navigation and Interface Design 213
Views and Controllers 213
View Controller 213
Tab Bar Controller 214
Navigation Controller 215
Creating the Interface 215
Creating the Project 215
Creating the Views 216
Design the Contacts Screen 222
Add Navigation Controller for the Date Screen 226
Activating the Interface 230
Summary 233
Exercises 233
11 Persistent Data in iOS 235
File Data Storage 235
User Defaults 236
Core Data 236
Setting Up Core Data 237
Creating the Project 237
Designing Data Structure 241
Passing Data Between Controllers 243
Saving Data to Core Data 248
Storing the Settings 251
Creating the Settings Interface 252
Working with NSUserDefaults Object 256
Activating the Settings Interface 257
Global Constants 259
Summary 262
Exercises 262
12 Tables in iOS: Navigation and Information
Display 263
Overview of Tables 263
Setting Up Tables 265
Populate the Table with Data 265
Retrieve Data from Core Data 269
Adding Contact Data 272
Display Detailed Data 273
Save Changes to Records 276
Deleting Records 277
Accessory Buttons 280
Alert View 281
Show Subtitles in the Table 285
Sort the Table 285
Summary 288
Exercises 288
13 Maps and Location in iOS 289
Overview of Location and Mapping 289
Hardware and Sensors 289
Core Location 290
MapKit 290
Adding Location Information to the App 291
Finding Location 291
Adding a Map 300
Summary 309
Exercises 309
14 Access to Hardware and Sensors in iOS 311
Getting Device Information 311
Monitoring Battery Status 314
Controlling the Camera 317
Calling a Phone Number 324
Long Press Gesture 324
Adding Long Press to Enabled Text Field 326
Using Core Motion for Accelerometer Data 328
Summary 333
Exercises 333
Part IV Business Issues 335
15 Monetizing Apps 337
App Monetization Strategies 337
Paid Apps 337
Ad Supported Apps 338
In-App Purchases 340
Understanding the Economics of App Stores 341
Owning Your Own Business 342
Create an LLC 342
Plan Your Business 342
Other Income Possibilities 343
Choosing a Platform 343
Summary 345
Exercises 345
16 Publishing Apps 347
App Distribution Through the App/Play Stores 347
Android Play Store Distribution 348
iOS App Store Distribution 351
App Distribution for the Enterprise 353
Android Enterprise Distribution 353
iOS Enterprise Distribution 354
Testing and Fragmentation 354
Keeping Up with the Platform 356
Summary 356
Exercises 357
Part V Appendixes 359
A Installing Eclipse and Setup for Android
Development 361
Setting up Java and Eclipse 361
Download and Install Java SE SDK 362
Downloading Eclipse 363
Installing Eclipse on Windows 363
Installing Eclipse on Mac 365
Installing Android 366
Setting Up the Classroom 369
B Installing Xcode and Registering Physical
Devices 371
Download and Install Xcode 371
Apple Developer Programs 372
Setting Up the Classroom 373
Deploying Apps to Real Devices 373
Creating Developer Accounts 375
Backing Up the Development Certificate 376
Registering Devices 378
Checking the Development Environment 379
C Introduction to Objective-C 383
A Brief History of Objective-C 383
Two Languages in One 384
Objects and Classes 385
Properties in Detail 394
Declaring and Calling Methods 396
Inheritance and Protocols 397
Memory Management 398
Index 399