CHAPTER 1: INTRODUCTION TO ANDROID, MOBILE DEVICES, AND THE MARKETPLACE



Similar documents
ITG Software Engineering

COURSE CONTENT. GETTING STARTED Select Android Version Create RUN Configuration Create Your First Android Activity List of basic sample programs

1. Introduction to Android

4 Application Development

INTERMEDIATE ANDROID DEVELOPMENT Course Syllabus

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

Application Development

Developer's Cookbook. Building Applications with. The Android. the Android SDK. A Addison-Wesley. James Steele Nelson To

UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

Here to take you beyond Mobile Application development using Android Course details

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

«compl*tc IDIOT'S GUIDE. Android App. Development. by Christopher Froehlich ALPHA. A member of Penguin Group (USA) Inc.

ANDROID INTRODUCTION TO ANDROID

Mobile App Design and Development

Getting Started with Android Programming (5 days) with Android 4.3 Jelly Bean

Android Application Development. Daniel Switkin Senior Software Engineer, Google Inc.

Google Android Syllabus

Android in Action. Second Edition. Revised Edition of Unlocking Android MANNING. (74 w. long.) W. FRANK ABLESON CHRIS KING ROBI SEN.

Android (Basic + Advance) Application Development

Table of Contents. Adding Build Targets to the SDK 8 The Android Developer Tools (ADT) Plug-in for Eclipse 9

Android Application Development

Android Application Development Distance Learning Program Brochure

Android Developer Fundamental 1

ANDROID TRAINING COURSE MODULES. Module-I: Introduction to Android. Introducing Android. Installing Development Tools. Using the Emulator.

Beginning Android Programming

Java 7 Recipes. Freddy Guime. vk» (,\['«** g!p#« Carl Dea. Josh Juneau. John O'Conner

Getting started with Android and App Engine

Practical Android Projects Lucas Jordan Pieter Greyling

Chapter 9: Customize! Navigating with Tabs on a Tablet App

Introduction to Android

Android Basics. Xin Yang

01. Introduction of Android

Module Title: Software Development A: Mobile Application Development

A Short Introduction to Android

Android Application Development Cookbook. 93 Recipes for Building Winning Apps

HYBRID APPLICATION DEVELOPMENT IN PHONEGAP USING UI TOOLKITS

INFORMATION BROCHURE

Jordan Jozwiak November 13, 2011

Graduate presentation for CSCI By Janakiram Vantipalli ( Janakiram.vantipalli@colorado.edu )

Android Application Development Lecture Notes INDEX

Introduction to Android: Hello, Android! 26 Mar 2010 CMPT166 Dr. Sean Ho Trinity Western University

How To Develop An Android App On An Android Device

Android Architecture. Alexandra Harrison & Jake Saxton

Lecture 1 Introduction to Android

Running a Program on an AVD

Android Application Development - Exam Sample

Android Application Development

CONTENTS CHAPTER 1: INTRODUCTION TO ANDROID, MOBILE DEVICES, AND THE MARKETPLACE 1

Workshop on Android and Applications Development

Introduction to Android Development. Jeff Avery CS349, Mar 2013

CHAPTER 1: INTRODUCTION TO SHAREPOINT

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

Developing Applications for ios

Developing and deploying mobile apps

Android Application Development Course Program

Software Development Interactief Centrum voor gerichte Training en Studie Edisonweg 14c, 1821 BN Alkmaar T:

Mobile Application Development 2014

Android Development. Lecture AD 0 Android SDK & Development Environment. Università degli Studi di Parma. Mobile Application Development

Des Moines Area Community College

CS378 -Mobile Computing. Android Overview and Android Development Environment

Introduction to Tizen SDK Alpha. Taiho Choi Samsung Electronics

PHA Android Application Development

Mobile application testing is a process by which application software developed for hand held mobile devices is tested for its functionality,

An Introduction to Android Application Development. Serdar Akın, Haluk Tüfekçi

Android Development Exercises Version Hands On Exercises for. Android Development. v

Professional Tizen Application Development

Learning ios Programming

Amcrest 960H DVR Quick Start Guide

Homeschool Programming, Inc.

MA-WA1920: Enterprise iphone and ipad Programming

Android Application Development: Hands- On. Dr. Jogesh K. Muppala

Introduction to Android. CSG250 Wireless Networks Fall, 2008

PEGA MOBILITY A PEGA PLATFORM WHITEPAPER

Android Geek Night. Application framework

Introduction to Android

ANDROID BASED MOBILE APPLICATION DEVELOPMENT and its SECURITY

Windows Store App Development

Elgg 1.8 Social Networking

HTML5 Applications Made Easy on Tizen IVI. Brian Jones / Jimmy Huang

Building an Android client. Rohit Nayak Talentica Software

[PACKTl. Flash Development for Android Cookbook. Flash, Flex, and AIR. Joseph Labrecque. Over 90 recipes to build exciting Android applications with

CS 528 Mobile and Ubiquitous Computing Lecture 2: Android Introduction and Setup. Emmanuel Agu

Programming with Android

Android Mobile App Building Tutorial

3. Software Installation. 4. Introduction to Android OS. 5. Using Android OS / Devices. 6. Eclipse debug with Android app. 8. Units of measurement

Android Programming and Security

QUALIFICATIONS PACK - OCCUPATIONAL STANDARDS FOR TELECOM INDUSTRY. SECTOR:TELECOM SUB-SECTOR: Handset (Terminal Applications) REFERENCE ID: TEL/Q2300

Creating and Using Databases for Android Applications

B.M. Harwani. Android Programming UNLEASHED. 800 East 96th Street, Indianapolis, Indiana USA

Course MS55077A Project Server 2013 Development. Length: 5 Days

Basics. Bruce Crawford Global Solutions Manager

Point of View Mobii Android 4.2 Tablet PC. General notices for use... 2 Disclaimer... 2 Box Contents... 2

Transcription:

FOREWORD INTRODUCTION xxiii xxv CHAPTER 1: INTRODUCTION TO ANDROID, MOBILE DEVICES, AND THE MARKETPLACE 1 Product Comparison 2 The.NET Framework 2 Mono 3 Mono for Android 4 Mono for Android Components 5 Development Tools 6 Mobile Development 6 Getting Around Support Issues 7 Design Issues 7 Android 8 History of Android 8 Writing Web-Based Applications for Android 9 Writing Native Applications for Android 9 Android Development Issues 9 Android SDK Tools 10 Android Development Costs 11 Cross-Platform Alternatives 12 Other Cross-Platform Tools 12 Considerations for Selecting a Cross-Platform Tool 12 How Does the Tool Allow You to Author Your Application? 13 What Device Features Does the Tool Support? 13 What Platforms Does the Tool Support? 14 What Skill Sets Does the Tool Require? 14 What Tools Exist to Support Development? 14 How Active Are the Development Community and Support Channels? 14 What Are the Successful Application Deployments for This Tool? 14 Summary 15 COPYRIGHTED MATERIAL

CHAPTER 2: INTRODUCTION TO MONO FOR ANDROID 17 Before You Begin Developing 17 What Is Mono? 17 Mono Implementation Goals 18 Mono Standards 18 What Is Mono for Android? 18 Why Do I Need Mono for Android? 18 Familiar Development Environment 19 Familiar API and Library Structure 19 What Are the Trade-Offs of Working with Mono for Android? 21 Waiting for Improvements 21 Taking a Potential Performance Hit 21 Memory Management 21 What Do I Need for the Mono for Android Development Environment? 22 Java SDK 22 Android SDK 22 Visual Studio 24 Visual Studio Development with Mono for Android 25 General Setup 25 Building Hello Android 26 Logging 28 Debugging 30 Testing 30 Deploying 31 Mono for Android Development with MonoDevelop 31 General Setup 31 Building Hello Android 32 Logging 34 Debugging 34 Testing 34 Deploying 35 Summary 35 CHAPTER 3: UNDERSTANDING ANDROID/MONO FOR ANDROID APPLICATIONS 37 What Is an Android Application? 38 The Building Blocks of an Android Application 39 Activities 39 Services 44 Content Providers 44 xii

Broadcast Receivers 47 Communicating between Components: Android Intents 49 Binding the Components: The Android Manifest 50 Android Manifest Basics 51 Editing the Manifest for Mono for Android via Visual Studio 54 Summary 56 CHAPTER 4: PLANNING AND BUILDING YOUR APPLICATION S USER INTERFACE 59 Guidelines for a Successful Mobile UI 59 Building an Android UI 60 Views 60 Design Surface 61 Choosing a Control Layout 61 AbsoluteLayout 62 FrameLayout 63 LinearLayout 63 RelativeLayout 65 TableLayout 67 Optimizing Layouts 68 Designing Your User Interface Controls 69 TextView 70 EditText 70 AutoCompleteTextView 71 Spinner 71 Button 73 Check Box 73 Radio Buttons and Groups 73 Clocks 76 Pickers 77 Images 79 ImageView 80 ImageButton 80 Gallery 80 Virtual Keyboards 84 Selecting Your Virtual Keyboard 86 Removing the Keyboard 86 Controlling Your Menus 87 Introducing the Menu System 87 Menus 87 Submenus 90 xiii

Context Menus 90 Defi ning Menus as a Resource 92 Menus 93 Context Menus 94 Resolution-Independent UI 95 Supporting Various Screen Resources 95 Supporting Screen Sizes 95 Supporting Pixel Densities 96 Using Android Market Support 97 Multiple Screen Resolution Best Practices 97 Constructing a User Interface: A Phone and Tablet Example 98 Summary 104 CHAPTER 5: WORKING WITH DATA 105 Working with SQLite 105 Setting Up a Database 106 Setting Up Tables 107 Using SQL Statements 108 Using Read/Select to Read Data 108 Using SQL Statements to Insert Data 110 Upgrading Strategies 110 Upgrading in Place 111 Copying Data 111 Android-Specific Database Options 111 SQLiteOpenHelper 111 Storing Data Remotely 113 Working with Remote Data 113 Accessing Enterprise Services 114 Using SOAP 115 Working with ASMX Web Services 115 Working with Windows Communication Foundation (WCF) 116 Using REST-Based Web Services 119 Using JavaScript Object Notation (JSON) 120 Posting Data with POST 124 Retrieving Data Using LINQ and XML 125 Using Asynchronous Data Retrieval 127 Using Web Services Responsibly 128 Working with Remote SQL Server Databases 128 Summary 130 xiv

CHAPTER 6: BINDING DATA TO CONTROLS 131 Databinding in Mono for Android 132 What Is a Data Adapter? 133 What Is an Adapter View? 133 How Do These Items Relate to One Another? 134 Working with Adapter Views and Large Data Sets 134 Exploring Adapters in Depth 137 Using Native Adapters 137 Exploring Adapter Views in Depth 138 Using Native Adapter Views 138 Working with Cursors 139 Using a Cursor to Populate a Spinner 139 Setting Up the Spinner and Data Source 140 Using a Spinner Adapter 143 Adding a Listener Event for a Spinner 144 Using a Cursor with a Gallery 147 Setting Up the Project 148 Adding the Cursor 150 Completing the Custom Adapter 152 Working with Lists 154 Displaying Simple Data in a List 155 Working with Android s ListAdapters 158 Customizing ListView with a Custom List Adapter 160 Handling ListView Events 166 Preferences Screen 168 Nested Navigation 171 Grouped Lists 173 Displaying Data in a Grid 177 Summary 182 CHAPTER 7: WORKING WITH THE FILE SYSTEM AND APPLICATION PREFERENCES 183 Working with the File System 184 File System Type and Structure 184 QuickEdit Sample Program: Working with a File Storage Example 189 Working with Application Preferences 195 Application Preference Types 195 Creating Your Own Application Preferences 196 xv

Preferences Program 197 Listening for Preference Changes 202 Processing XML 204 Summary 205 CHAPTER 8: PROGRAMMING WITH THE DEVICE HARDWARE 207 Working with Sensors 208 Referencing the Sensor Manager 208 Sensor Support 208 Accessing Sensors 209 Using Sensors 209 Understanding the Sensor Type Values 211 Responding to Acceleration 212 Using the XYZ Coordinate System 213 Coding with the Accelerometer 213 Building a Compass 214 Vibration 218 Networking Connectivity 219 ConnectivityManager 219 Checking User Communication Preferences 219 Checking for Changes to BackgroundDataSetting 220 Checking Current Network Confi guration 221 Creating Network Connectivity Notifi cations 221 Wifi Manager 221 WiFi States 224 WiFi Changes 225 Bluetooth Manager 225 Working with Bluetooth State 226 Enabling Voice Recognition in Your App 227 Getting Turn-by-Turn Directions 229 Summary 235 CHAPTER 9: USING MULTIMEDIA AUDIO, VIDEO, AND THE CAMERA 237 Android Media Classes 238 Playing Audio and Video 239 Media Player Supported Formats 239 Programming Audio Playback 240 Programming Video Playback 244 Controlling Playback 247 Managing Playback Output 247 xvi

Recording Audio and Video 247 Using Intents to Record Video 248 Using the Media Recorder 251 Confi guring Video Recording 251 Previewing Video Recording 252 Audio Recording 253 Images and Using the Camera 254 Using Intents to Take Pictures 254 Controlling the Camera 257 Managing Camera Settings and Picture Options 257 Monitoring Autofocus 259 Using the Camera Preview 260 Taking a Picture 261 Reading and Writing JPEG Exif Values 262 Adding New Media to the Media Store 263 Using the Media Scanner 263 Adding New Media to the Store 264 Speech Recognition 265 Summary 266 CHAPTER 10: TALKING TO OTHER APPLICATIONS AND LIBRARIES 269 Android Application Integration 269 Opening the Browser 269 Opening E-mail 272 Making a Telephone Call 273 Sending a Text/SMS Message 274 Opening a Location in the Maps Application 276 Opening a YouTube Video 276 Opening the Market 277 Application Integration 278 Simple Integration with HootSuite and Other Twitter Applications 279 Confi guring Your Intent Filters 279 Handling Incoming Intent Requests 280 Integrating with Contacts 280 Displaying Contact Details 283 Picking a Contact 284 Creating a New Contact 285 Creating a New Contact or Adding to an Existing Contact 286 Summary 287 xvii

CHAPTER 11: DEVELOPING BACKGROUND SERVICES AND ASYNCHRONOUS CODE 289 The Life Cycle of a Service 290 Creating Your First Service 290 Prioritizing Services 293 Using Threads for Asynchronous Processing 294 Threading Manually 295 Utilizing System.Threading.Tasks 297 Implicit Threading with the IntentService 298 Communicating with the UI 299 Using the Binder and Service Connection Method 299 Using the Broadcast Receiver Method 303 Using the Static Event Method 305 Notifying the User with Notifications 308 Scheduling Intents with Alarms and the IntentService 310 Push Notifi cations Using Cloud to Device Messaging (C2DM) 312 Listening for C2DM in Your Application 313 Sending a C2DM Message from Your Server 317 Summary 321 CHAPTER 12: CANVAS AND DRAWABLES: BUILDING CUSTOM ANDROID GRAPHICS 323 Working with Graphics in Mono for Android 324 Using the Canvas Object 325 Graphics Primitives 326 The Canvas Object 327 The Paint Object 328 The Bitmap Object 329 Bringing It All Together 330 A Path Primer 330 Case 1: Creating a Custom Graphic 331 Case 2: Responding to Events 336 Case 3: Animating Custom Graphics 342 Case 4: Improving Performance Using SurfaceView 347 Selecting the Best Approach 351 The 2D Graphics Library 352 Using Drawables 352 Drawables as XML Resources 353 Simple and Compound Drawables 354 xviii

Drawables in Action 354 Case 1: Using Default Drawables 354 Case 2: Adding Polish with the Shape Drawable 356 Case 3: Using the Gradient Drawable 360 Case 4: Using the Compound Drawable 362 Case 5: Interacting with a Custom Drawable 366 Summary 369 CHAPTER 13: WORKING WITH LOCATION INFORMATION 371 Understanding Location Basics 372 Determining Location 373 Location-Based Data Interruptions 373 Using Location-Based Services 374 Confi guring Location-Based Applications on the Emulator 374 Selecting a Location Provider 377 Determining Which Providers Are Available 377 Finding Location Providers with Criteria 377 Geocoding 379 Forward Geocoding 379 Reverse Geocoding 380 Constructing Proximity Alerts 382 Using Google Maps 384 Getting Your Development/Debugging MD5 Fingerprint 385 Getting Your Production/Release MD5 Fingerprint 386 Creating the Maps-Based Activity 386 Creating a Map in a Layout File 387 Using the MapView Controller with an Overlay 388 Summary 391 CHAPTER 14: INTERNATIONALIZATION AND LOCALIZATION 393 Selecting a Localization Strategy 395 Updating Language and Regional Settings 396 Understanding the Mechanics of Android Localization 398 Setting Up Default Resources 398 Adding Localization Support 399 Resource Selection in Detail 399 Supporting Multiple Languages 400 Utilizing the Strings.xml File 400 Translating Text 401 xix

Translating Control Text 404 Localizing Other Resources 406 Localizing the Menu Icon and Application Name 409 Advanced Usage of Strings.xml 410 String Array 410 Plurals 410 String Replacements 411 Working with Format Conversions 414 Formatting Dates 414 Formatting Numbers and Currency 414 Summary 415 CHAPTER 15: SHARING CODE BETWEEN MONO FOR ANDROID, MONOTOUCH, AND WINDOWS PHONE 7 417 Overview of the Three Platforms 417 Mono for Android 418 MonoTouch 418 Windows Phone 7 419 Using Class Libraries to Separate the Code 420 Using Preprocessor Directives 420 Mono for Android 421 Windows Phone 7 421 MonoTouch 422 Assemblies Available on Each Platform 422 One Class Library to Rule Them All 425 Mono for Android 426 MonoTouch 428 Windows Phone 7 429 Putting It All Together: Creating a Cross-Platform Application 431 Summary 443 CHAPTER 16: PREPARING AND PUBLISHING YOUR APPLICATION TO THE MARKET 445 Preparing Your Application 446 Testing Your Application 446 Hitting the Key Testing Areas 447 Tools for the Testing Trade 449 Unit Testing 449 DDMS 449 The Emulator 452 xx

Traceviews 453 Stress Testing via the Application Exerciser Monkey 455 UI Testing via the Monkeyrunner 456 Involving Peers and Users in the Testing Process 456 Publishing Your Application to the Android Market 457 Versioning Your Application 457 Creating the Final Build 459 Signing Your Application 461 Creating a Private Key 461 Creating a Self-Signed Certifi cate 464 Aligning the Final Package 464 Uploading to the Android Market 465 Summary 466 CHAPTER 17: ANDROID TABLETS 469 Examining the Android Tablet Marketplace 469 Designing a Tablet UI 470 Using the Action Bar 472 Removing the Action Bar 473 Adding Items to the Action Bar 473 Using the Application Icon 477 Navigating Up the Stack 477 Adding and Using Action Items 478 Creating a Tabbed Interface 479 Partial Screen Control Using Fragments 480 Creating Fragments 481 More Fragments 486 Summary 494 APPENDIX A: TIPS FOR DEVELOPERS AND THE FUTURE OF MONO AND ANDROID 495 Best Practices, Hints, Tips, and Gotchas 495 Android Honeycomb (3.0) and Ice Cream Sandwich (4.0) 499 Fragments for All! 502 Android Version and Device Fragmentation 503 What s Next for Mono for Android? 504 Using Xamarin.Mobile for Cross-Platform Mobile Functionality 505 INDEX 507 xxi