Extended 10Edition
Total Page:16
File Type:pdf, Size:1020Kb
th 10EDITION N TE DE D Xcompletely E UPDATED S T E I E L & R L FOR F published by: Services and Tools for All Mobile Platforms Enough Software GmbH + Co. KG Sögestrasse 70 28195 Bremen Germany www.enough.de Please send your feedback, questions or sponsorship requests to: [email protected] Follow us on Twitter: @enoughsoftware 10th Edition February 2012 This Developer Guide is licensed under the Creative Commons Some Rights Reserved License. Design and Artwork by Andrej Balaz (Enough Software) Character Artwork by Johanna Kromp (www.organisiertekunst.de) Mobile Developer’s Guide Table of Contents 1 Introduction 4 An Overview Of Application Platforms 4 Native Applications 6 Java ME (J2ME) 6 Flash 7 BREW 7 Websites And Web Apps 8 Web Widgets 10 SMS Text Messaging 11 Programming Android Apps 13 Prerequisites 13 Implementation 16 Testing 17 Signing 17 Distribution 19 Programming bada Apps 20 Getting Started 21 Implementation 25 Documentation & bada Resources 25 Testing 26 Distribution 27 Programming BlackBerry Apps 28 Prerequisites 30 Coding Your Application 30 Services 31 Testing 32 Porting 33 Signing 33 Distribution 34 Programming Flash Apps 35 Prerequisites 36 Tips And Tricks 38 Testing 39 Packaging And Distribution 40 Programming iOS Apps 41 Prerequisites 44 Implementation 45 Testing 46 Distribution 47 Books 49 Community 50 Programming J2ME / Java ME Apps 51 Prerequisites 53 Implementation 56 Testing 57 Porting 59 Signing 60 Distribution 62 Programming Qt Apps 64 Prerequisites 64 Creating Your Application 66 Testing 67 Packaging 67 Signing 68 Distribution 71 Programming Symbian Apps 72 Prerequisites 73 Testing 73 Signing 74 Distribution 75 Programming Windows Phone Apps 76 UI Design 77 Development 80 Functions and Services 80 Multitasking and Application Lifecycle 81 Native Code 82 Distribution 83 Testing And Analytics 84 Monetization 85 Resources 87 Programming Windows 8 Apps 87 Prerequisites 88 Developing Metro Style Apps 93 Distribution 94 Resources 95 Programming Mobile Widgets 96 Widget Characteristics 100 Prerequisites 100 Writing Your Code 102 Testing 104 Signing 104 Distribution 105 Programming With Cross-Platform Tools 106 Limitations And Challenges Of Cross Platform Approaches 111 Cross-Platform Strategies 115 Cross-Platform Solutions 119 Creating Mobile Websites 119 Context Is King 120 Usability Aspects 122 Technical Limits of Web Technologies 125 Fragmentation 126 Website Adaptation 130 Hybrid Apps 131 Lessons Learned 133 Developing Accessible Apps 133 General Platform Accessibility 134 Making Your App Accessible 138 In Conclusion 139 Implementing Rich Media 139 Streaming vs. Local Storage 141 Progressive Download 141 Media Converters 142 Implementing Location-Based Services 142 How To Obtain Positioning Data 144 How To Obtain Mapping Services 145 Implementing Location Support On Different Platforms 147 Tools For LBS Apps 149 Implementing Near Field Communication (NFC) 151 Support For NFC 151 Creating NFC Apps 153 Implementing Haptic Vibration 157 Basic Vibration Control on Android 158 Extending Basic Vibration Control 159 Implementing Security Measures 160 General Concepts 161 The Threats To Your Applications 162 Hiding the Map of Your Code 163 Hiding Control-Flow 164 Active Protection That Stays With The Application 164 White-Box Cryptography 165 Protection Tools 166 Resources 166 The Bottom Line 167 Testing Your Application 167 Testability: The Biggest Single Win 168 Headless Client 168 Separate The Generic From Specific 169 Test-Driven Development 169 Physical Devices 170 Remote Control 171 GUI Test Automation 171 Beware Of Specifics 171 Crowd-Sourcing 172 Web-Based Content And Applications 8 173 Monetization 174 Pay Per Download 177 In-App Payment 178 Mobile Advertising 179 Revenue Sharing 179 Indirect Sales 180 Marketing And Promotion 181 Strategy 182 What Can You Earn? 183 Appstores 184 Basic Strategies To Get High 185 Multi-Store vs Single Store 187 Now What – Which Environment Should I Use? 187 The Business Perspective: Market Reach 191 The Developer’s Perspective: Technology 195 Epilogue 196 About the Authors Introduction Welcome to the 10th anniversary edition of our Mobile Develop- ers Guide To The Galaxy! We introduced the first version of this overview of mobile technology exactly 3 years ago, at Mobile World Congress 2009. And we are flattered to see that it has grown from a thin brochure into a small book, and become one of the best-known publications about app development. All this would not have been possible without the community’s support: Our thanks go out to all the writers who are sharing their know- how on the following pages, to the printing sponsors for their financial support and to all the individuals who are helping to distribute the book at events and among universities, schools and other organizations worldwide. We are also glad to inform you that our friends from WIP have started to put out a companion guide to this book: Get their “Mobile Developer’s Guide To The Parallel Universe” on www.wipconnector.com or on their WipJams and learn everything about app marketing. As always the ever-changing kaleidoscope of the mobile in- dustry does just that — it keeps changing. Since our last edi- tion: Windows 8 was revealed, Adobe discontinued Flash for Introduction 1 mobile browsers, Tizen released a preview SDK, HP changed its mind and announced webOS would continue as an Open Source project, Sony separates from Ericsson, Nokia released its first Windows Phone products and acquired Smarterphone, BlackBerry seemingly jumps off the Java bandwagon with BlackBerry 10, Android expanded its reach to TVs and other appliances, Apple made the world speak to its phone and much more. As usual these changes are reflected in this guide. We have also added two completely new chapters: how to implement haptics into your app and how you can protect your code against security attacks right from the start. We hope you enjoy the book and we are looking forward to see- ing the project continue to grow. Please get involved and let us know what content might be missing, at [email protected]. Robert + Marco / Enough Software Bremen, February 2012 2 An Overview Of Application Platforms There is a wide selection of platforms with which you can realize your mobile vision. This section describes the most common en- vironments and outlines their differences. More detailed descrip- tions follow in the platform-specific chapters. Native Applications There are many mobile platforms used in the market – some are open source, some are not. The most important native platforms are (alphabetically) Android, bada, BlackBerry, BlackBerry Play- Book OS (QNX), iOS, Symbian, Windows 8 and Windows Phone. All these platforms enable you to create native applications without establishing a business relationship with the respective vendor. The main benefits of programming apps natively include bet- ter integration with the platform’s features and often better per- formance. Typical drawbacks are the effort and complexity of supporting several native platforms (or limiting your app to one platform). Most mass market featurephones are, however, equipped with embedded operating systems that do not offer the opportunity to create native applications. Examples include but are not lim- ited to Nokia Series 40, Samsung SGH and LG featurephones. The following table provides an overview of the main mobile platforms: An Overview Of Application Platforms 4 Platform Language(s) Remarks Open Source OS (based on Linux) Android Java, C, C++ developer.android.com Samsung’s mobile platform running bada C, C++ on Linux or RealTime OS developer.bada.com Java ME compatible, extensions BlackBerry Java, Web Apps enable tighter integration blackberry.com/developers BlackBerry Tab- ActionScript, The forthcoming BlackBerry 10 OS let/PlayBook C++, HTML, CSS, will be based on QNX as well OS (QNX) JavaScript blackberry.com/developers The mobile OS that introduced iOS Objective-C, C mobile apps to ordinary people. developer.apple.com/iphone C, C++, Java, Currently the longest running of all Symbian Qt, Web Apps, smartphone OSs others www.forum.nokia.com/symbian Supports native HTML5 HTML, CSS, programming, (based on Linux), webOS JavaScript, C future should be Open Source developer.palm.com C#/VB.NET, C++, Microsoft’s first real tablet OS Windows 8 JavaScript msdn.microsoft.com/en-us/windows/apps Windows C#, VB.NET Silverlight, XNA frameworks Phone create.msdn.com An Overview Of Application Platforms 5 Java ME (J2ME) Around 70% of all featurephones worldwide support the mobile Java standard (Java ME formerly known as J2ME), making it by far the most widely distributed application environment. In con- trast to many other environments, Java ME is a standard rather than a product, which can be implemented by anyone (who pays Oracle the corresponding license fees that is). Standardization is the strength of Java ME but at the same time it’s the source of many fragmentation problems. On many feature phones, Java ME is the only way to real- ize client side applications. With the increasing penetration of smartphones, Java ME has lost importance, at least in the US and Europe. However, as TechCrunch puts it: With 27% smartphone market share, it´s still a feature phone world out there1. That is why, particularly in emerging economies, Java ME remains the main option to target the mass market. It has been also hailed as the fastest growing platform for mobile devices, driven by the demand for feature rich yet inexpensive phones in emerging economies2. Flash