Statistics
4
Views
0
Downloads
0
Donations
Support
Share
Uploader

高宏飞

Shared on 2026-02-16

AuthorWenyun Dai, Keke Gai, Meikang Qiu

Mobile Applications Development with Android: Technologies and Algorithms presents advanced techniques for mobile app development, and addresses recent developments in mobile technologies and wireless networks. The book covers advanced algorithms, embedded systems, novel mobile app architecture, and mobile cloud computing paradigms. Divided into three sections, the book explores three major dimensions in the current mobile app development domain. The first section describes mobile app design and development skills, including a quick start on using Java to run an Android application on a real phone. It also introduces 2D graphics and UI design, as well as multimedia in Android mobile apps. The second part of the book delves into advanced mobile app optimization, including an overview of mobile embedded systems and architecture. Data storage in Android, mobile optimization by dynamic programming, and mobile optimization by loop scheduling are also covered. The last section of the book looks at emerging technologies, including mobile cloud computing, advanced techniques using Big Data, and mobile Big Data storage. About the Authors Meikang Qiu is an Associate Professor of Computer Science at Pace University, and an adjunct professor at Columbia University. He is an IEEE/ACM Senior Member, as well as Chair of the IEEE STC (Special Technical Community) on Smart Computing. He is an Associate Editor of a dozen of journals including IEEE Transactions on Computers and IEEE Transactions on Cloud Computing. He has published 320+ peer-reviewed journal/conference papers and won 10+ Best Paper Awards. Wenyun Dai is pursuing his PhD at Pace University. His research interests include high performance computing, mobile data privacy, resource management optimization, cloud computing, and mobile networking. His paper about mobile app privacy has been published in IEEE Transactions on Computers. Keke Gai is pursuing his PhD at Pace University. He has published over 60 peer-review

Tags
No tags
ISBN: 1498761879
Publisher: Chapman and Hall/CRC
Publish Year: 2017
Language: 英文
Pages: 320
File Format: PDF
File Size: 7.2 MB
Support Statistics
¥.00 · 0times
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

(This page has no text content)
MOBILE APPLICATIONS DEVELOPMENT WITH ANDROID Technologies and Algorithms
(This page has no text content)
MOBILE APPLICATIONS DEVELOPMENT WITH ANDROID Technologies and Algorithms Meikang Qiu, Wenyun Dai, and Keke Gai Pace University, New York City, New York, USA
CRC Press Taylor & Francis Group 6000 Broken Sound Parkway NW, Suite 300 Boca Raton, FL 33487-2742 © 2017 by Taylor & Francis Group, LLC CRC Press is an imprint of Taylor & Francis Group, an Informa business No claim to original U.S. Government works Printed on acid-free paper Version Date: 20160512 International Standard Book Number-13: 978-1-4987-6186-4 (Hardback) This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information stor- age or retrieval system, without written permission from the publishers. For permission to photocopy or use material electronically from this work, please access www.copy- right.com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that pro- vides licenses and registration for a variety of users. For organizations that have been granted a photo- copy license by the CCC, a separate system of payment has been arranged. Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe. Visit the Taylor & Francis Web site at http://www.taylorandfrancis.com and the CRC Press Web site at http://www.crcpress.com
Contents List of Figures xiii List of Tables xxi Preface xxiii Acknowledgments xxv Author Biographies xxvii Section I Mobile App Design and Development Skills Chapter 1  Overview of Mobile App and Mobile Interface 3 1.1 MOBILE SYSTEM 4 1.2 MOBILE INTERFACE AND APPLICATIONS 6 1.2.1 Optimizations in Mobile Systems 8 1.2.2 Mobile Embedded System 8 1.3 MOBILE CLOUD 9 1.3.1 Big Data Application in Mobile Systems 10 1.3.2 Data Security and Privacy Protection in Mobile Systems 11 1.3.3 Concept of Mobile Apps 13 1.3.4 Brief Introduction of Android and Its Framework 14 1.3.4.1 A Brief History of Android 14 1.3.4.2 Android Device Distribution 16 v
vi  Contents 1.3.4.3 Android SDK 16 1.4 EXERCISES 21 Chapter 2  Quick Start on Android 23 2.1 INSTALLING JAVA 23 2.2 INSTALLING INTEGRATE DEVELOPMENT ENVIRONMENT 24 2.3 INSTALLING ANDROID SDK 25 2.4 CREATING AN ANDROID APPLICATION 26 2.5 ANDROID VIRTUAL DEVICE 27 2.6 EXERCISES 35 Chapter 3  Introduction of Key Concepts of Android 37 3.1 APP COMPONENTS 38 3.1.1 Activities 38 3.1.2 Services 38 3.1.3 Content Providers 39 3.1.4 Intents 39 3.2 APP RESOURCES 41 3.3 APP MAINFEST 42 3.3.1 Elements 43 3.3.2 Attributes 44 3.3.3 Declaring Class Names 44 3.3.4 Multiple Values 44 3.3.5 Resource Values 45 3.3.6 Sting Values 45 3.4 EXERCISES 46 3.4.1 Basic Exercises 46 3.4.2 Advanced Exercises 47
Contents  vii Chapter 4  2­D Graphics and Multimedia in Android 49 4.1 INTRODUCTION OF 2­D GRAPHICS TECHNIQUES 50 4.1.1 Color 50 4.1.2 Paint 52 4.1.3 Path 52 4.1.4 Canvas 53 4.1.5 Drawable 54 4.1.6 Button Selector 58 4.2 ADVANCED UI DESIGN 59 4.2.1 Multiple Screens 59 4.2.2 Action Bar 62 4.2.3 Custom Views 63 4.3 OVERVIEW OF MULTIMEDIA IN ANDROID 64 4.3.1 Understanding the MediaPlayer Class 64 4.3.2 Life Cycle of the MediaPlayer State 65 4.4 AUDIO IMPLEMENTATIONS IN ANDROID 66 4.5 EXECUTING VIDEO IN ANDROID 67 4.6 EXERCISES 72 4.6.1 Basic Exercises 72 4.6.2 Advanced Exercises 74 Section II Advanced Mobile App Optimizations Chapter 5  Mobile Embedded System Architecture 77 5.1 EMBEDDED SYSTEMS 78 5.1.1 Embedded Systems Overview 78 5.2 SCHEDULING ALGORITHMS 81 5.2.1 Basic Concepts 81 5.2.2 First-Come, First-Served Scheduling Algorithm 82 5.2.3 Shorted-Job-First Scheduling Algorithm 84 5.2.4 Multiprocessors 85
viii  Contents 5.2.5 Priority Scheduling Algorithm 88 5.2.6 ASAP and ALAP Scheduling Algorithm 91 5.2.6.1 ASAP 93 5.2.6.2 ALAP 94 5.3 MEMORY TECHNOLOGY 96 5.4 MOBILE EMBEDDED SYSTEMS 97 5.4.1 Embedded Systems in Mobile Devices 97 5.4.2 Embedded Systems in Android 98 5.4.3 Power Management of Android 100 5.4.4 Embedded Systems in Mobile Apps 101 5.5 MESSAGING AND COMMUNICATION MECHANISMS 102 5.5.1 Message Mechanisms 103 5.5.2 Communication Mechanisms 104 5.6 EXERCISES 106 Chapter 6  Data Storage and SQLite Operations 109 6.1 LOCAL DATA 110 6.1.1 Internal and External Storage 110 6.1.2 Save a File on Internal Storage 111 6.1.3 Save a File on External Storage 113 6.1.4 Delete a File 116 6.1.5 Query the Space 117 6.2 SQLITE DATABASE 118 6.2.1 Table Structure 119 6.2.2 CRUD Operations 119 6.2.3 Usage of SQLite Techniques 124 6.3 CONTENT PROVIDER 126 6.4 EXERCISES 128 6.4.1 Basic Exercises 128 6.4.2 Advanced Exercises 129
Contents  ix Chapter 7  Mobile Optimization by Dynamic Programming 131 7.1 INTRODUCTION OF HETEROGENEOUS EMBEDDED SYSTEMS AND DYNAMIC PROGRAMMING 133 7.2 FIXED TIME MODEL 134 7.2.1 Heterogeneous Assignment 134 7.2.2 Minimizing Costs by Scheduling 136 7.3 PROBABILISTIC TIME MODEL 143 7.3.1 Introduction of Probabilistic Time Model 143 7.3.2 Solutions to Heterogeneous Assignment Problems 147 7.3.3 Generating a D Table 147 7.3.4 Example of Generating a D Table 149 7.4 NONDETERMINISTIC POLYNOMIAL­TIME PROBLEMS 161 7.4.1 Cook’s Theorem 161 7.5 EXERCISES 162 7.5.1 Fundamental Questions 162 7.5.2 Practical Questions 163 7.6 GLOSSARY 165 Chapter 8  Mobile Optimizations by Loop Scheduling 167 8.1 INTRODUCTION 168 8.2 BASIC GRAPH MODELS AND TECHNIQUES 169 8.2.1 Data-Flow Graph in Loop Scheduling 169 8.2.2 Retiming and Unfolding 171 8.3 FUNDAMENTAL TIMING OPTIMIZATIONS 173 8.4 TIME AND POWER OPTIMIZATIONS WITH LOOP SCHEDULING 177 8.4.1 Probabilistic Data-Flow Graph 177 8.4.2 Loop Scheduling and Parallel Computing 180 8.5 CONCLUSIONS 186 8.6 EXERCISES 187
x  Contents 8.6.1 Fundamental Questions 187 8.6.2 Practical Questions 188 8.7 GLOSSARY 190 Section III Mobile App Techniques in Emerging Technologies Chapter 9  Mobile Cloud Computing in Mobile Applications Deployment 195 9.1 INTRODUCTION 196 9.2 CONCEPTS OF MOBILE CLOUD COMPUTING 197 9.2.1 Technological Structure of Mobile Cloud Computing 197 9.2.2 Differences between Cloud Computing and Mobile Cloud 198 9.2.3 Mobile Computing 200 9.2.4 Wireless Networks 201 9.2.4.1 Wireless Local Area Networks (WLANs) 202 9.2.4.2 Comparison between Wireless Local Area Networks and Wireless Fidelity 205 9.2.4.3 Wireless Wide Area Network 205 9.2.4.4 Cellular Network 206 9.3 MAIN TECHNIQUES OF MOBILE CLOUD COMPUTING 208 9.3.1 Virtualization 208 9.3.2 Parallel Programming Model 210 9.3.3 Mass Distributed Storage 211 9.4 MOBILE CLOUD COMPUTING ARCHITECTURE 212 9.5 EXERCISES 214 9.5.1 Fundamental Questions 214 9.5.2 Practical Questions 215 9.6 GLOSSARY 215
Contents  xi Chapter 10  Efficient Data Synchronization on Mobile Devices in Big Data 221 10.1 OVERVIEW OF BIG DATA 222 10.1.1 Understanding Data Type 222 10.1.2 Categorizing Big Data Models 223 10.1.3 Current Challenges in Big Data 224 10.2 BIG DATA PROCESSING 225 10.2.1 Machine Learning 227 10.2.1.1 Supervised Learning 227 10.2.1.2 Unsupervised Learning 231 10.2.1.3 Semisupervised Learning 233 10.3 MOBILE BIG DATA STORAGE 233 10.3.1 Introduction and Basic Concepts 233 10.3.2 Heterogeneous Memory Architecture 235 10.3.3 Multi-dimensional Dynamic Programming Data Allocation 237 10.4 SECURITY AND PRIVACY ISSUES 246 10.5 DATA DEDUPLICATION 250 10.6 EXERCISES 251 10.6.1 Fundamental Questions 251 10.6.2 Practical Questions 252 Section IV Appendices Appendix 1: Project 1 255 PROJECT DESCRIPTION 255 PROJECT OBJECTIVE 255 PROJECT GUDELINES 255 PROJECT PLAN 256 Appendix 2: Project 2 257
xii  Contents PROJECT DESCRIPTION 257 PROJECT OBJECTIVE 257 PROJECT REQUIREMENTS 257 PROJECT PLAN 257 Appendix 3: BirthProvider.java. Codes 261 BIRTHPROVIDER.JAVA. CODES 261 Bibliography 269
List of Figures 1.1 Structure of a cellular network. 5 1.2 Logo of Wi-Fi. 5 1.3 Four dominate platforms for mobile apps. 6 1.4 Structure of the telehealth systems. 7 1.5 Main structure of mobile cloud computing. 9 1.6 Android device distribution in January and July 2012. 15 1.7 Android device distribution in August 2012 and August 2013. 15 1.8 Android device distribution in January 2014 and Jan- uary 2015 15 1.9 Android system architecture. 17 1.10 Android Emulator. 18 1.11 Process of producing an Android app. 20 2.1 Verify the version of Java. 24 2.2 Blank interface of Android Studio. 25 2.3 Android SDK Manager in Android Studio. 26 2.4 Details of Android SDK Manager in Android Studio. 27 2.5 First Step of creating an Android Application in An- droid Studio. 28 2.6 First step of creating an Android application in An- droid Studio. 29 2.7 Second step of creating an Android application in An- droid Studio. 29 2.8 Last step of creating an Android application in Android Studio. 30 xiii
xiv  LIST OF FIGURES 2.9 Interface of Android Studio with a new Android project. 30 2.10 Android Virtual Device Manager in Android Studio. 31 2.11 First Step of Creating an Android Virtual Device in Android Studio -1. 32 2.12 Second Step of Creating an Android Virtual Device in Android Studio -2. 32 2.13 Last Step of Creating an Android Virtual Device in Android Studio. 33 2.14 New Virtual Device in AVD Manager in Android Studio. 33 2.15 Android Virtual Device in Android Studio 34 2.16 Android Application Running on the Android Virtual Device in Android Studio 34 3.1 Default MainActivity.java. 41 3.2 File hierarchy for a simple project. 42 3.3 Default AndroidManifest.xml 45 4.1 Colors as constants provided by Android. 51 4.2 Preview of colors in XML files in Android Studio. 52 4.3 Paint class in Android. 52 4.4 Create two Path object and add details to them. 53 4.5 A new activity whose contentView is the view created ourselves but not layout.xml. 54 4.6 The “onDraw()” method that draws a circle and a rect- angle. 55 4.7 Running result of GraphicsView. 55 4.8 Use Bitmap to create a new Canvas. 56 4.9 The first step of creating a new Drawable resource file. 56 4.10 The second step of creating a new Drawable resource file. 57 4.11 Shape Drawable. 57 4.12 Gradient background. 58 4.13 Stroke, Corners, and Padding Drawables 58 4.14 Default state of button. 59
LIST OF FIGURES  xv 4.15 Pressed state of the button. 60 4.16 Running result of the button selector. 60 4.17 Original image (.png). 61 4.18 Nine-patch image (.9.png). 62 4.19 A nine-patch image used in various sizes. 62 4.20 A typical action bar. 62 4.21 State diagram of the MediaPlayer. 65 4.22 Creating two buttons in activity_main.xml. 66 4.23 MediaPlayer object and the OnClickListener. 67 4.24 Implementing the functions of two buttons in onClick() method. 68 4.25 Running result of the MediaTester. 68 4.26 Android device monitor. 70 4.27 Android device Monitor. 70 4.28 Push a file onto the device. 71 4.29 Setting video path and start a video. 71 4.30 The running result of the MediaTester. 72 5.1 The diagram of the process states. 82 5.2 A schedule for k jobs. 83 5.3 An example of FCFS scheduling. 84 5.4 Another FCFS result if changing arrival sequence. 84 5.5 An example of SJF scheduling. 84 5.6 An SJF schedule to complete nine jobs in three proces- sors. 86 5.7 Another schedule to complete nine jobs in three pro- cessors. 87 5.8 An example of the priority scheduling. 89 5.9 An example of the nonpreemptive SJF solution. 90 5.10 Example of the preemptive SJF solution. 90 5.11 A sample of the directed acyclic graph. 92 5.12 A simple ASAP for minimum latency scheduling. 93 5.13 ALAP scheduling for latency-constraint scheduling. 94
xvi  LIST OF FIGURES 5.14 Hardware structure of a smartphone. 98 5.15 Linux Kernel of Android. 100 5.16 Power management of Android. 101 5.17 A finite-state machine of the Android power manage- ment. 102 5.18 prepare() and loop() methods. 103 5.19 Use handler to add message into Message Queue. 104 5.20 Transmit data via Binder Driver in RPC framework. 106 5.21 Scheduling DAG for the Question Two 108 6.1 “/data/data/” directory in Android device monitor. 112 6.2 Example of the directory of the new file. 113 6.3 Checking the external storage state for reading. 114 6.4 Checking the external storage state for reading and writing 115 6.5 Getting the directory of public files. 115 6.6 Getting the directory of private files. 116 6.7 Directory names provided by API constants. 116 6.8 Deleting a File from Internal Storage 117 6.9 Deleting Album File in Public Directory with Name. 117 6.10 Getting the current available and total space in the internal storage. 118 6.11 Result of getSpace(). 118 6.12 Example of contact. 120 6.13 Some private attributes in DatabaseHandler Class. 121 6.14 onCreate() and onUpgrade() methods. 121 6.15 Overview of CRUD operations. 122 6.16 addContact() Method. 122 6.17 getContact() Method. 123 6.18 getAllContacts() Method. 123 6.19 updateContact() Method. 124 6.20 deleteContact() Method. 124
LIST OF FIGURES  xvii 6.21 Running result about addContact() and getAllCon- tacts(). 125 6.22 Running result about getAllContacts(). 125 6.23 Running Result of deleteContact() 126 6.24 Running result of updateContact(). 126 6.25 The user interface of CPTester. 128 6.26 The running result of CPTester. 128 7.1 An example of a data flow graph with functional units. 135 7.2 An example of a data flow graph with two types of functional units. 135 7.3 (a) Assignment 1 with a cost of 26. (b) Assignment 2 with a cost of 35. 137 7.4 The calculation form for a minimum resource schedul- ing algorithm. 138 7.5 The first update of the MRSA form. 139 7.6 The second update of the MRSA form. 139 7.7 The first possible path from A to B under timing con- straint 5. 140 7.8 The paths from A to B under timing constraint 6. 140 7.9 Optimal paths for A → B under different timing con- straints. 140 7.10 Optimal paths for B → C under different timing con- straints. 141 7.11 Optimal paths for C → D under different timing con- straints 142 7.12 Optimal paths for A → B → C → D under different timing constraints 143 7.13 A given probabilistic data flow graph. 145 8.1 An example of a Data-Flow Graph (DFG). 170 8.2 An example of Retimed Data-Flow Graph (DFG) 172 8.3 Retiming formulation. 172 8.4 A template example of assignment. 175 8.5 A template example of rotation. 176
xviii  LIST OF FIGURES 8.6 An example of the minimum cycle periods using Theo- rem 8.1. 177 8.7 An example of probabilistic DFG corresponding with Table 8.2. 179 8.8 The probabilistic data-flow graph for program W . 181 8.9 Iterations of the static schedule for the given data-flow graph. 182 8.10 The probabilistic data-flow graph for program W . 183 8.11 The probabilistic data-flow graph after retiming. 183 8.12 The static scheduling probabilistic data-flow graph be- fore regrouping. 183 8.13 The optimization procedure of the probabilistic data- flow graph with retiming. 184 8.14 Iterations of the probabilistic data-flow graph after re- timing. 186 8.15 Figure for practical question 2). 189 8.16 Figure for practical question 3). 189 9.1 Technical structure of mobile cloud computing. 198 9.2 A diagram of leveraging mobile cloud computing. 199 9.3 Three key aspects of mobile computing and examples. 200 9.4 A structure of the Wi-Fi network. 204 9.5 An example of the cellular network structure. 207 9.6 An example of using a virtual machine to deliver cloud services. 209 9.7 A structure of adopting mass distributed storage. 212 9.8 Architecture of mobile cloud computing. 213 10.1 The modeling table of big data. 225 10.2 Data science venn diagram. 226 10.3 An example table for Bayes. 228 10.4 Regression analysis. 230 10.5 PCA of a multivariate Gaussian distribution. 232 10.6 Two examples of clustering. 232
LIST OF FIGURES  xix 10.7 Moore’s Law. Retrieved from http://archive.isgtw.org/ images/mooreslaw.jpg. 234 10.8 Combine MRAM and SRAM into on-chip memory. 236 10.9 Combine DRAM and PCM into off-chip memory. 236 10.10 Heterogeneous SPM architecture for CMP. 237 10.11 The first step of dynamic programming. 240 10.12 The second step of dynamic programming. 242 10.13 The third step of dynamic programming. 244 10.14 The fourth step of dynamic programming. 245 10.15 Data deduplication. 251 10.16 Print-screens of OS Monitor as samples. 258