mobile app

Download Mobile app

Post on 13-May-2015

455 views

Category:

Documents

22 download

Embed Size (px)

TRANSCRIPT

  • 1.Mobile Application DevelopmentDejvuth Suwimonteerabuth

2. Why mobile application development?Worldwide mobile device sales to end users totaled 1.55 billionunits in 2011, a 11 percent increase from 2010 [IDC]Sales for the rst quarter of 2012 [IDC]: 3. Phones get smarterAround 26% of worldwide sales in 2011 are smartphones, andestimated to reach 1 billion (47%) in 2015 [Gartner]In U.S., 49.7% have smartphones, the trend is accelerating [Nielsen] 4. Smartphones arent smart without appsMore than 600,000 apps available [Business Insider] 5. Apps can make a lot of moneyThe mobile app market will reach $15 billion by 2013[Research2guidance] 6. Mobile applications are not ported desktop apps! Factors that need to consider when working on a mobile app: Memory Limited, and much of it is already allocated App speed Usage patterns of mobile app are different Apps need to load and work quickly Internet access Network is not always available and typically slow Display Smaller display User input Buttons, touch screen 7. A bit of history and outlook 8. Brief history of mobile devices PDA (Personal Digital Assistant) 9. PDA PhonePDA + mobile phone PDA phone 10. SmartphonesNow PDA phones are called smartphones, offering manycomputer-like functionalities 11. Mobile applications Applications for handheld devices such as PDA, smartphones Development environment: 12. Wars on smartphone platform (2010) [Canalys] 13. Wars on smartphone platform (2012) [Gartner, IDC] 14. Wars on smartphone platform [Nielsen] 15. Apple vs. GoogleBattle continues, arguments varied . . .. . . depending on who you askA look into history: compare with Mac/PC battlesSimilar (many PC manufacturers, one Apple)Different (Microsoft sells Windows, Google gives awayAndroid) 16. Apple still dominates the market, but . . . 17. Another look at recent trends In April 2011, Android added 28,000 new apps, Apple 11,000 apps [Research2guidance] 18. This course 19. This courseApplication development for the Android platformIntroduction to iOSEmphasis on basics to make the contents robust to changes.Theories behind mobile communicationPrerequisite: strong Java programming skillsImportant: Things change and not everything can be covered inthis course. Self-learning skill is necessary.Android phone is not required 20. TopicsJava refresherKey concepts of AndroidDesigning the user interface2D graphicsMultimediaLocal data storageNetwork accessEmbedded database3D graphics in OpenGLMulti-touchWidget 21. ScheduleOn 10 Jun, 24 Jun, 8 Jul, 22 Jul, 19 Aug, 2 Sep, 16 Sep, 30 SepLecture: 08:3012:00Lab: 13:0017:00 Dont come to class late! 22. Grading Midterm exam 25% Final exam 25% Project25% Lab15% Attendance & Participation 10%Below 50% is fail, above 80% is AThe rests are proportional 23. Project At the end of the course, each of you must program an application on Android You can program anything you want (but use your creativity!) Due date: 30 September Each of you must give a presentation on that day Make sure your program is fully tested (non-functional programs are worse than simple but functional programs)! Write down a documentation of what your program does Marks are given based on creativity, complexity, documentations, and the presentation 24. Literature The slides will be updated during the course of the lecture References: Hello, Android Introducing Googles Mobile Development Platform, Ed Burnette, 3rd Edition (2010). http://developer.android.com Any Java and Android books on the market 25. Java refresher 26. Why refresh?Android applications are written in JavaWithout fully understanding Java, you will not be able to writeany Android applicationsImportant: Take your time with Java, make sure you understandits conceptsWe will use the slides Java Refresher Course fromAndrea Camesi, EPFL 27. Key Concepts 28. What is Android?An open source software stack that includesOperating system: Linux kernel, provides low levelinterface with hardware, memory management, andprocess controlMiddleware: A run time to execute Android applications,including Dalvik virtual machine and core librariesKey mobile apps: Email, SMS, PIM, web browser, etcAPI libraries for writing mobile app such as SQLite,WebKit, and OpenGL ESOpen-source development platform for creating mobile apps 29. Android history Android Inc. founded in 2003. Google acquired Android Inc. in 2005 Open Handset Alliance established on 5 November 2007 Led by Google with 34 members (now 80 rms) Android is rst announced on that dayCode name based on adessert item, inalphabetical order:1.5 Cupcake, 1.6 Donut,2.0/2.1 Eclair, 2.2 Froyo,2.3 Gingerbread,3.0/3.1 Honeycomb, and4.0 Ice Cream Sandwich 30. Android SDK featuresNo licensing, distributions, or development frees or releaseapproval processesGSM, EDGE, and 3G networks for telephony and data transferFull multimedia hardware controlAPIs for using sensor hardware including accelerometer andthe compass.APIs for location based servicesInter-process communicationShared data storageBackground applications and processesHome screen widgets, Live FoldersHTML5 WebKit-based web browserAnd many more . . . 31. Android SDKThe Android SDK includesThe Android APIs: the core of the SDKDevelopment tools: for compiling and debuggingThe Android Virtual Device (AVD) Manager and EmulatorDocumentationsSample codeThere is no dedicated IDE for AndroidHowever, Android has a special plugin for Eclipse, called ADTPlugin, for creating Android projectsADT Plugin tightly integrates Eclipse with the Android Emulatorand debugging tools 32. Android architecture 33. Android architecture 34. Linux kernel Android is built on top of a solid and proven foundation: the Linux kernel Created by Linus Torvalds in 1991 Linux can be found today in everything from wristwatches to supercomputer It provides the hardware abstraction layer for Android as well as memory management, process management, networking, and other operating system services Android phone user will never see Linux, and your programs will not make Linux calls directly 35. Native libraries Next layer above the kernel, written in C or C++ Compiled for the particular hardware architecture used by the phone, and preinstalled by the phone vendor Important libraries include: Surface Manager: a compositing window manager 2D and 3D graphics Media codecs for recording and playing variety of formats including AAC, AVC (H.264), H.263, MP3, and MPEG-4 SQLite database for storing persistent data WebKit: a browser engine for fast display of HTML content Libraries are not applications by themselves. They are only to be called by higher-level layers. 36. Android runtimeAnother layer on top of the kernel.Android runtime includes the Dalvik virtual machine (VM) andthe core Java libraries.Dalvik VM is Googles implementation of Java, optimized formobile devicesDiffer from traditional Java VM:Dalvik VM runs .dex les, converted at compile time fromstandard .class and .jar les. Reason: .dex les aremore compact.Androids core Java libraries are different from both theJava Standard Edition (Java SE) libraries and the JavaMobile Edition (Java ME) libraries 37. Application frameworkSitting above the native libraries and runtimeProvides high-level building blocks for creating applicationsComes pre-installed with Android, can be extend if neededImportant parts are:Activity manager controls the life cycles of applications anduser navigationContent providers encapsulate data that needs to beshared between applications, such as contactsResource manager provides access to non-code resourcessuch as localized strings, graphics, and layout lesLocation manager provides location informationNotication manager presents messages to users 38. Applications and widgets The highest layer. They are what users see. Applications are programs that take over the whole screen and interact with users Widgets operate only in a small rectangle of the Home screen application Standard system applications: phone dialer, email, contacts, web browser, Android markets The most part of this course will cover application development. Widgets development is at the end of the course. 39. Life cycle 40. One foreground application at a time On PC, many applications running and visible at once in different windows. One of the windows has keyboard focus, but otherwise all the programs are equal. In Android, one foreground application, typically takes over the whole screen except for the status line. Users rst see the Home application when turning on their phones 41. Application stack When the user runs an application, Android starts it and brings it to the foreground. From that application, the user might invoke another application, or another screen in the same application, and then another and another. All these programs and screens are recorded on the application stack by the systems Activity Manager. At any time, the user can press the Back button to the previous screen on the stack. 42. Process = applicationInternally, each user interface screen is represented by anActivity classEach activity has its own life cycleAn application is one or more activities plus a Linux process tocontain themHowever, the activity life cycle is not tied to the process lifecycleProcesses are just disposable containers for activities, so anapplication can be alive even if its process has been killed! 43. Life cycle During its lifetime, each activity of an Android program can be in one of the following states: 44. Life cycle (cont.) Developers do not have control over what states their programs are in The system manages changes of states and notify developers when they are about to change through the onXX() method calls We override these methods in the Activity class, and Android will call them at the appropriate time: onCreate(Bundle): This is called when the activity rst starts up. You can use it to perform one-time initialization such as creating the user interface. onCreate() takes one parameter that is either nu