1. Trang chủ
  2. » Công Nghệ Thông Tin

Android Apps with Eclipse ppt

368 934 1

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 368
Dung lượng 18,99 MB

Nội dung

www.it-ebooks.info For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. www.it-ebooks.info i Android Apps with Eclipse ■ ■ ■ Onur Cinar www.it-ebooks.info iv Contents at a Glance About the Author x About the Technical Reviewer xi Introduction xii ■Chapter 1: Android Primer 1 ■Chapter 2: Application Architecture 27 ■Chapter 3: Eclipse Primer 45 ■Chapter 4: Mastering Eclipse 73 ■Chapter 5: Android Development Tools for Eclipse 111 ■Chapter 6: Project: Movie Player 151 ■Chapter 7: Android Native Development Using Eclipse 185 ■Chapter 8: Project: Extending Movie Player for AVI Movies 239 ■Chapter 9: Android Scripting Using Eclipse 271 ■Chapter 10: Project: Movie Player Using HTML and JavaScript 307 ■Appendix A: Testing Android Applications 333 ■Index 349 www.it-ebooks.info xii Introduction Android is one of the major players in the mobile phone market, and its market share is continuously growing. Android is the first complete, open, and free mobile platform, and it offers endless opportunities for mobile application developers. As with all other platforms, having a robust and flexible development environment is the key for the platform's success. Eclipse is the most adopted integrated development environment (IDE) for Java programmers. And now Eclipse is the preferred IDE for Android app developers. Android Apps with Eclipse provides a detailed overview of Eclipse, including the steps and illustrations to help Android developers quickly get up to speed on Eclipse and to streamline their day-to-day software development. Who This Book Is For This book is for both beginners and intermediate developers who would like to quickly come up to speed on Android development using the Eclipse IDE. What You Will Learn This book covers the following topics:  How the Android platform works and the basics of Android application development  How to use the most popular Java IDE, Eclipse, to develop Android applications  How to install and configure Eclipse for Android development  How to leverage Eclipse with the Android Native Development Kit (NDK) for C/C++ needs  How to leverage Eclipse for scripting using Android's Scripting Layer for Android (SL4A)  How to debug and troubleshoot Android applications using Eclipse www.it-ebooks.info INTRODUCTION xiii Downloading the Code The source code for this book is available to readers from http://www.apress.com. Contacting the Author Readers can contact the author through his Android Apps with Eclipse site at http://www.zdo.com/android-apps-with-eclipse. www.it-ebooks.info 1 Chapter Android Primer In this chapter, we will briefly cover the Android platform from various angles. We will start with Android’s history, to better understand the motivations behind its formation. Then we will explore the Android platform architecture’s fine combination of technologies that empower the platform to deliver a superior mobile experience. We will emphasis the multilayer Android security framework, which employs both software and hardware to keep the platform secure. We will briefly review the service application programming interfaces (APIs) that are provided through the Android framework for user-level applications to interact with the platform. Finally, we will discuss Android application deployment and distribution. Android History Android Inc. was founded in Silicon Valley, California, in October 2003, with the idea of providing a mobile platform that is more aware of the user’s location and preferences. Google acquired Android Inc. in August 2005 as a wholly owned subsidiary of Google Inc. Google’s main intention was to provide a fully open platform, backed by Google technologies, for both the users and the application developers. In November 2007, the Open Handset Alliance was founded as a consortium to develop an open standard for mobile devices. Open Handset Alliance began its journey by announcing the Android platform. In less than a year, new members started joining this consortium. www.it-ebooks.info CHAPTER 1: Android Primer 2 Android became an open source initiative that is led by Google under Open Handset Alliance’s umbrella. The goal of the Android open source project is to provide an open platform to improve the mobile experience of users. Android is the first complete, open, and free mobile platform.  Complete: The Android platform is a robust, secure, easily upgradable, mobile platform with a comprehensive framework and well-defined interfaces. It allows application developers to develop and fully blend their applications into the platform. It also provides compatibility and certification programs, so device manufacturers can design highly compliant devices.  Open: The entire Android platform has been developed and provided under open source Apache licensing terms. Android does not distinguish between preloaded applications and third-party applications. Developers have full access to device features and services while developing applications.  Free: The Android platform does not charge any licensing, royalty, membership, or certification fees to develop applications on the platform. Android platform source code and software development kits are provided free of charge to application developers. The software development platform is widely available on many desktop operating systems, allowing application developers to develop applications using the operating system of their choice. Today, Android is one of the major players in mobile phone market. Based on the recent market analysis, on average, 700 thousand Android devices are activated daily, and more than 200 million devices are already activated. Android currently has 48% of the mobile phone market share, and it’s growing rapidly. Android Versions The first beta of the Android platform was released on November 5, 2007. Since then, it has been through a number of updates and bug fixes. Although bug fixes are usually transparent from the application developer’s perspective, updates usually mean changes and additions to the framework API. For that reason, besides the Android platform version numbers, a second version number, called the API level , is used to identify the framework API that is supported. Since April 2009, each Android version has been released under a codename based on desserts, such as Éclair, Froyo, and Gingerbread. This introduced a third versioning scheme to the Android platform, making things even more www.it-ebooks.info CHAPTER 1: Android Primer 3 cryptic for first-time Android application developers. When speaking of Android application development, you will often hear people say things like ‘‘my application requires Éclair and above,’’ ‘‘this method requires at least API level 9,’’ and ‘‘my phone got the Android 2.1 update.’’ Understanding which version and which API level they are referring to, as well as which new APIs are part of which Android platform version, can easily become a cumbersome memory exercise. You can use Table 1-1 as a reference to map between these three version schemes. NOTE: Since the Android platform is continuing to evolve, Table 1-1 may not cover the latest platform revisions. For an up-to-date listing, refer to the API Levels section of the Android Developer Pages, at http://developer.android.com/guide/appendix/api-levels.html. Table 1-1. Android Release Dates, Revisions, API Levels, and Codenames Release Date Platform Version API Level Codename November 5, 2007 Beta September 23, 2008 Android 1.0 1 February 9, 2009 Android 1.1 2 April 30, 2009 Android 1.5 3 Cupcake September 15, 2009 Android 1.6 4 Donut October 26, 2009 Android 2.0 5 Éclair December 3, 2009 Android 2.0.1 6 Éclair January 12, 2009 Android 2.1 7 Éclair May 20, 2010 Android 2.2 8 Froyo January 18, 2011 Android 2.2.1 8 Froyo January 22, 2011 Android 2.2.2 8 Froyo www.it-ebooks.info CHAPTER 1: Android Primer 4 Release Date Platform Version API Level Codename November 21, 2011 Android 2.2.3 8 Froyo December 6, 2010 Android 2.3 9 Gingerbread February 9, 2011 Android 2.3.3 10 Gingerbread July 25, 2011 Android 2.3.5 10 Gingerbread September 2, 2011 Android 2.3.6 10 Gingerbread February 22, 2011 Android 3.0 11 Honeycomb May 10, 2011 Android 3.1 12 Honeycomb July 15, 2011 Android 3.2 13 Honeycomb September 20, 2011 Android 3.2.1 13 Honeycomb August 30, 2011 Android 3.2.2 13 Honeycomb October 19, 2011 Android 4.0.1 14 Ice Cream Sandwich November 28, 2011 Android 4.0.2 14 Ice Cream Sandwich December 16, 2011 Android 4.0.3 15 Ice Cream Sandwich February 4, 2012 Android 4.0.4 15 Ice Cream Sandwich As shown in Table 1-1, there are 15 API levels that you should consider while developing your applications. The API level determines the size of your audience as well, so picking this number wisely is very important while developing a new Android application. The Android mobile phone market is highly fragmented. By simply looking at the release dates, you might think that most of the Android user base is running at least Android 3.0, since it has already been around for a year; however, this is not true. Due to the fragmentation, the release dates are far from giving a clear view of Android versions in use. Figure 1-1 is the latest version distribution chart from Android Platform Versions Dashboard (http://developer.android.com/resources/dashboard/platform- versions.html). www.it-ebooks.info [...]... sponsored, or paid The Android platform comes with a default marketplace, Google Play, previously known as the Android Market, which is an online store developed by Google for Android devices Unlike the Android platform, the Android Market application is not open source It is available only for devices that comply with Google’s compatibility requirements The client portion comes preloaded on Android devices... the Android Market During installation, the Android Market application displays a www.it-ebooks.info CHAPTER 1: Android Primer list permissions requested by the application and gets the user’s implicit permission before proceeding with installation Although most Android devices come with Google’s Android Market application preloaded, other application distribution channels are supported by the Android. .. Amazon Appstore are two alternatives for Android application distribution Summary We started this chapter with a brief summary of Android s history and the existing Android versions We then explored the core of Android platform and the Linux kernel, and briefly reviewed the Android- specific changes and additions to the Linux kernel to deliver a superior mobile platform We explained the reasons behind Android s... of the user’s interaction with that application:  An application with a foreground activity, which the user is currently interacting with, is considered the most important one  An application with a visible activity, which is not currently interacting with the user but still visible, is also considered important www.it-ebooks.info CHAPTER 1: Android Primer  An application with a background activity,... connection Although Android does not expect application developers to use these partitions directly, knowing their purpose can be very useful during Android application development Security As with many other mobile platforms, the biggest requirement for Android, from the users’ perspective, is the security and integrity of users’ applications and data Android is designed with security in mind The Android architecture... develop Android applications that support multiple Android platform versions The main goal of the Support Package is to simplify the process of supporting multiple Android versions from a single code base You can find more information about the Support Package at http://developer .android. com/sdk/compatibility-library.html www.it-ebooks.info 5 6 CHAPTER 1: Android Primer Android Platform Architecture Android. .. calling process with each Binder request Binder is a key construct in the Android platform It is the central messaging channel across the entire Android platform Android applications communicate with the system, services, and each other through the Binder interface Although Binder is implemented as a low-level service, application developers are not expected to directly interact with it The Android runtime... Android runtime provides the android. os.IBinder interface as the API to communicate with other processes through Binder Android provides the Android Interface Definition Language (AIDL), which is tuned for Binder AIDL allows you to define the programming interface that the client and server will use to communicate with each other As with many other operating systems, on Android, the processes are not... by the operating system, Android also enhances the Android platform binaries using ProPolice to protect them from stack buffer overflow attacks File system protection is also one of the new Android features available since Android 3.0 It allows Android to encrypt the entire storage media using the AES-128 algorithm This prevents other people from accessing the user’s data without knowing the key used... applications to interact with the Android platform Finally, we discussed Android development and distribution In the next chapter, we will focus on the Android application architecture www.it-ebooks.info 25 Chapter Application Architecture Understanding the architecture of an Android application is key for solid application development In this chapter, we will start exploring the Android application architecture . author through his Android Apps with Eclipse site at http://www.zdo.com /android- apps- with- eclipse. www.it-ebooks.info 1 Chapter Android Primer In. programmers. And now Eclipse is the preferred IDE for Android app developers. Android Apps with Eclipse provides a detailed overview of Eclipse, including

Ngày đăng: 15/03/2014, 20:20

TỪ KHÓA LIÊN QUAN