Introduction to Android Development: Before Getting Started

4,856 views

Published on

Prepared for ESAB Seminar at AIUB

Published in: Technology, Business
2 Comments
2 Likes
Statistics
Notes
No Downloads
Views
Total views
4,856
On SlideShare
0
From Embeds
0
Number of Embeds
29
Actions
Shares
0
Downloads
350
Comments
2
Likes
2
Embeds 0
No embeds

No notes for slide

Introduction to Android Development: Before Getting Started

  1. 1. Android Application Development Seminar on Getting Started Ahsanul Karim ahsanul.karim@sentinelbd.com Sentinel Solutions Ltd. http://www.sentinelbd.comEngineering Students Association of Bangladesh (ESAB) http://androidstream.wordpress.com
  2. 2. Before Introduction
  3. 3. Before Introduction: Your Suggestions1. Monotonous discussion should be bannedBut, let me try… after all it’s a free seminar.No one’s going to kill me….
  4. 4. Before Introduction: Your Suggestions2. This could be the first phase and it should be continued.3. Arranging a workshop is better than seminar for the novice.We have following probable plans: 1. Workshops 2. Training Programs 3. Onsite Contests with help from experienced Developers 4. Idea-based Contests with help from experienced Developers 5. Jamming Events Depends on your feedback
  5. 5. Before Introduction: Your Suggestions4. You can emphasize on learning OOPs before startingsession on Android. Because very large number of SoftwareDeveloper have no clear concept on OOP. OOP concept is indispensable. But we have to learn in parallel.5. It might get a little more interesting if the attendants areallowed to have the opportunity to play or use some of theandroid apps themselves. Can you suggest how can we do that? May be next time we’ll try. We may review some good apps today.
  6. 6. Before Introduction: Your Suggestions6. If you give us some knowledge regarding to developingandroid software and how to post them in the androidmarket it can be helpful to us in the future. We’ll do that in this session7. You can give us some video about mobile applicationprogramming which can help us. We’ll provide you complete course content with video tutorials we did in BASIS (Bangladesh Association of Software & Information Services)
  7. 7. Before Introduction: Your Suggestions8. Consider all type of audience. Excellent suggestion. We’ll try that9. Discuss from technological perspective as well as business Excellent suggestion. We’ll try that10. Forecast about near future associated with Android. Excellent suggestion. We’ll try that
  8. 8. So Today… 1. Get Basic Idea on Mobile and Smartphone Applications 2. Get Basic Idea on Mobile, Smartphone & Tablet Platforms 3. Identify the Position of Android Platform 4. Background and History of Android 5. Get the Idea: Why Should We Learn Android Platform 6. Opportunities 7. Some App Demos 8. System Architecture 9. Environment Setup to Kick-start 10. Application Structure 11. Cross-platform development 12. Resources
  9. 9. Mobile and Smartphone ApplicationsMobile PhonesA mobile phone (also called mobile, cellular telephone, cell phone,or hand phone is an electronic device used to make 1. Calls across a wide geographic area. 2. Send Text SMS 3. Can see call records 4. Can capture image 5. Can run music 6. Can browse web etc.To learn about mobile phones in details:http://en.wikipedia.org/wiki/Mobile_phoneYou’ll get detailed history about how thistechnology evolved over the years
  10. 10. Mobile and Smartphone ApplicationsMobile Phone Applications: Some ExamplesCategory: Utility ToolsPersonal Finance Calculator Another example can be: Daily Planner Application Possible Features: 1. Task List 2. Reminder 3. Appointment etc.
  11. 11. Mobile and Smartphone ApplicationsMobile Phone Applications: Some Examples (Contd.)Category: GamesSudoku Tetris Snake
  12. 12. Mobile and Smartphone ApplicationsMobile Phone Applications: Development1. Different Mobile phone vendor companies use different platforms for developing applications for their own platform.2. We’ll discuss about a open “Legacy” platform as an example which is J2ME Java Platform, Micro Edition, or Java ME: 1. It is a Java platform designed for embedded systems (mobile Devices are one kind of such systems) . 2. Target devices range from industrial controls to mobile phones with Java (KVM support). Formerly known as Java 2 Platform, Micro Edition (J2ME). For details: http://en.wikipedia.org/wiki/Java_Platform,_Micro_Edition Nokia, Samsung, Sony Ericsson and many other vendors supports J2ME for applications and games development
  13. 13. Mobile and Smartphone ApplicationsMobile Phone Applications: Development With J2MELimitations1. Memory Issues 1. Vendor Specific Implementation 2. Insufficient Memory 3. Inefficient Memory Management2. Device Compatibility Issues3. Not enough Access to Core System of the Phone4. Vendor Specific Implementation of KVMThat is why…We see sites like this:
  14. 14. Mobile and Smartphone ApplicationsSmart Phones1. A smartphone is a mobile phone that offers more advanced computing ability, Features and connectivity than a contemporary mobile phones.2. Smartphones may be thought of as handheld computers integrated with a mobile telephone.3. They also provide their own Operating System with Application Development Framework To learn about smart phones in details: http://en.wikipedia.org/wiki/Smartphone You’ll get detailed history about how this technology evolved over the years
  15. 15. Mobile and Smartphone ApplicationsSmart Phones Platforms Android iPhone BlackBerry Palm Pre
  16. 16. Mobile and Smartphone ApplicationsTablet Platforms Android: Galaxy Tab Apple: iPad
  17. 17. Overview of Application Platforms (alphabetically)Platform Language (s) RemarksAndroid Java, C, C++ Open Source OS (Based on Linux) http://developer.android.combada C, C++ Samsung’s mobile platform running on Linux or RealTime OS http://developer.bada.comBlackBerry Java, Web Apps Java, Web Apps, Java ME compatible, extensions enable tighter integration http://na.blackberry.com/eng/developersiOS Objective-C, C Requires Apple Developer Account http://developer.apple.com/iphoneMeeGo Qt, C++, others Intel and Nokia guided open source OS (based on Linux) http://meego.com/developersSymbian C, C++, Java, Qt, OS built from the ground up for mobile devices Web Apps, http://www.forum.nokia.com/symbian others
  18. 18. Overview of Application Platforms (Cont.)Platform Language (s) RemarkswebOS HTML, CSS, Supports widget style programming (based on Linux) JavaScript, C http://developer.palm.comWindows C#, C .NET CF or Windows Mobile API, most devices shipMobile with Java ME compatible JVM http://developer.windowsmobile.comWindows C#, VB.NET Silverlight, XNA FrameworksPhone http://create.msdn.com Source: http://mobileplatforms.wikidot.com/
  19. 19. Application Platforms
  20. 20. Why Android T h e y s a y a p i c t u r e i s wo r t h
  21. 21. Why Android (Cont.) T h e y s a y a p i c t u r e i s wo r t h
  22. 22. Why Android (Cont.)
  23. 23. Why Android (Cont.)
  24. 24. Why Android (Cont.)
  25. 25. Why Android (Cont.)
  26. 26. Why Android (Cont.)
  27. 27. Why Android (Cont.)
  28. 28. Why Android: Google TV
  29. 29. Why Android: Finally BlackBerry Gives In
  30. 30. Open Handset Alliance (Nov 2007) Manufacturers: Designing the Android HandsetsContent Providers: Developing Apps Mobile Operators Markets: Distribution
  31. 31. Why Android (Cont.) What about ASIA-Pacific region??? Low cost devices from China manufacturers… $96 Android devices
  32. 32. Why Android (Cont.)Technical Advantages No need to pay for any developer’s program to develop and test apps in real devices Open source platform with scope of more innovation (Less proprietary restrictions) Java programming language Rich and easy to integrate feature sets Easy, effective and cost-effective prototyping for research and business Development Environment Support in Windows, Mac & Linux (Ubuntu) I ma g i n a t i o n i s t h
  33. 33. Why Android (Cont.)Business Advantages Android market: Integrated market app One time low registration fee Many Distribution Channels: (We’ll see next) Low Barrier to Market: No approval process Less restrictions with copyright issues
  34. 34. Why Android (Cont.)Opportunities Android market: (http://market.android.com) Integrated Android Market Application in phones can ensure your reach to millions of users without any approval process. Amazon Appstore for Android: http://www.amazon.com/mobile-apps/b?ie=UTF8&node=2350149011 Enterprise Market: https://marketplace.cisco.com/ 3rd Party Distribution Channels : 1. Andspot 2. Handango 3. GetJar 4. SlideMe 5.AndAppStore 6. AndroLib 7. AppBrain and many more…
  35. 35. Why Android (Cont.)Opportunities Android Market: (1) Analytics to help decision making
  36. 36. Why Android (Cont.)Opportunities Android Market: (2) Crash log to support bug fixes
  37. 37. Why Android (Cont.)Opportunities Android Market: (3) Requirements
  38. 38. Why Android (Cont.)Opportunities Amazon Appstore for Android:
  39. 39. Why Android (Cont.)Opportunities Enterprise Market: $ $ $ $ $ $ $
  40. 40. Why Android (Cont.)Monetization Opportunities Paid Apps $ $ $ $ $ $ $ In-App Billing Free Apps with Ads AdMob AdWhirl Mobclix and many more
  41. 41. Why Android (Cont.) Freelancing Opportunities Statistics Source: http://www.elance.com/android-programmers-freelancers/230 Similar trend is seen in other freelancing sites Can be a good source of income to support your own product development or research
  42. 42. Why Android (Cont.)Game Development OpportunitiesCase Study: AhhhPah http://ahhhpah.com/ Development Time: 8 hours Downloads: millions Simplified Game frameworks 1. Libgdx: http://code.google.com/p/libgdx/ 2. AndEngine: http://www.andengine.org/ 3. Unity3d: http://unity3d.com/
  43. 43. Why Android (Cont.)Some Interesting Apps Shazam Hear a song you dont know? INSTALLS:10,000,000 - 50,000,000 Shazam identifies it instantly.
  44. 44. Why Android (Cont.)Some Interesting Apps Guitar : Solo Lite INSTALLS:10,000,000 - 50,000,000
  45. 45. Why Android (Cont.)My Story ProTranslate INSTALLS: 50,000 - 100,000 It gave us Google’s Device Seeding Program AwardFeatures:1. Support for wide range of languages2. Share translated text (Email,SMS,twitter,facebook) Pronounciation and speech output3. Website translation Document translation and share via email4. Auto-prompt to translate SMS received5. Optimized for all Android devices
  46. 46. Why Android (Cont.)My Story ProTranslate
  47. 47. Why Android (Cont.)Research OpportunitiesEasy Prototyping of any idea is possible in Android. Some of the advancedresearch based projects are prototyped in Android. mHealth eMOCA (www.emocha.org) Developed by the Johns Hopkins Center for Clinical Global Health Education, eMOCHA uses video, audio, touchscreen quizzes, GPS and SMS to collect and analyze large amounts of data.
  48. 48. Why Android (Cont.)Research OpportunitiesEasy Prototyping of any idea is possible in Android. Some of the advancedresearch based projects are prototyped in Android. mHealth ClickDiagnostics http://clickdiagnostics.com/ Developed by ClickDiagnostics, uses video, audio, touchscreen Quizzes to upload data to server to reach the consultants.
  49. 49. Why Android (Cont.)Research OpportunitiesmHealth Clinical diagnosis + Data acquisition
  50. 50. Why Android (Cont.)Research OpportunitiesAndroid + Arduino = Innovation UnlimitedArduino (http://www.arduino.cc/) 1. Arduino is an open-source electronics prototyping platform 2. can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators. http://arduino.cc/blog/2011/10/12/androi d-open-2011-massimo-banzi-arduino- android-infinite-possibilities/
  51. 51. Why Android (Cont.)Research OpportunitiesAndroid in Disaster Management A Mobile Disaster Management System Using the Android Technology http://www.naun.org/journals/communications/19-280.pdfImplementation of an Android based disaster management systemhttp://www.bcdph.com/download/android.pdf Android Incident Reporting for SAHANA Disaster Management System http://code.google.com/p/sahana-incident-reporter/ Case Study: Bangladesh Army 1. Custom sensor device to accumulate weather data 2. Create forecast 3. Use data feeds to plan strategies for recovery 4. Integrated solar cell for self sufficient power
  52. 52. Why Android (Cont.) Application Development Opportunities Augmented RealitySome more: http://techsplurge.com/3214/mega-list-33-awesome-augmented-reality-apps-games-android/Real World Environment+ Sound, Video, Graphics data generated by systems= AR
  53. 53. Why Android (Cont.)Research OpportunitiesAndroid in Space!!! http://www.youtube.com/watch?v=REsEgrhmMjc
  54. 54. What is AndroidAndroid is a software stack for mobile devices that includes anoperating system, middleware and key applications. TheAndroid SDK provides the tools and APIs necessary to begin developingapplications on the Android platform using the Java programming language.Google describes Android as:The first truly open and comprehensive platform for mobile devices, allof the software to run a mobile phone but without the proprietaryobstacles that have hindered mobile innovation.
  55. 55. Android FeaturesFeatures1. Application framework2. Dalvik virtual machine3. Integrated browser4. Optimized graphics5. SQLite Storage6. Media support7. GSM Telephony8. Bluetooth, EDGE, 3G, and WiFi9. Camera, GPS, compass, and accelerometer10.Rich development environment
  56. 56. Android Features (Cont.) Accelerometer GPS Thermal Sensor Your App + With logic to Actuate = Gyroscope Light Sensor TTS Voice Search Magnetic Sensor
  57. 57. Android Architecture
  58. 58. Setting up Development EnvironmentSystem Requirements Supported OS 1. Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit) 2. Mac OS X 10.5.8 or later (x86 only) 3. Linux (tested on Ubuntu Linux, Lucid Lynx) Supported Development Environment (Eclipse IDE based) 1. Eclipse 3.4 (Ganymede) or greater/Eclipse Classic (versions 3.5.1 and higher) 2. JDK 1.5 or 1.6 3. ADT Plugin
  59. 59. Setting up Development Environment(Contd.)To set up the development environment, we need:1. Java Development Kit (JDK 1.5+, 1.6 is preferable)2. Eclipse IDE3. Android SDK
  60. 60. Setting up Development Environment (Contd.) Java Development Kit (JDK) Download Link: http://www.java.com/en/download/index.jsp Download JDK from here and Install JDK
  61. 61. Setting up Development Environment (Contd.) Eclipse IDE Download Link: http://eclipse.org/downloads/ Download the highlighted version of Eclipse IDE
  62. 62. Setting up Development Environment (Contd.) Android SDK Link: http://developer.android.com/sdk/index.htmlDownload and Install the SDK starter package from the table above (Highlighted)
  63. 63. Setting up Development Environment (Contd.) Android SDK Setup (1)1. Install available packages to get all SDK platform versions
  64. 64. Setting up Development Environment (Contd.) Android SDK Setup (2)2. Installation progress
  65. 65. Setting up Development Environment (Contd.) Android SDK Setup (3)3. ADT Plugin for EclipseADT Plugin:Android Development Tools (ADT) is a plugin for the Eclipse IDE for1. extending the capabilities of Eclipse to set up new Android projects2. creating an application UI3. adding components based on the Android Framework API4. debugging your applications using the Android SDK tools5. exporting signed (or unsigned) APKs in order to distribute your application We’ll see the 5 points gradually during development
  66. 66. Setting up Development Environment (Contd.) Android SDK Setup (4)4. Installing the ADT 1. Start Eclipse, then select Help > Install New Software.... 2. Click Add, in the top-right corner. 3. In the next window, youll see a list of the tools to be downloaded. Click Next. 4. Read and accept the license agreements, then click Finish. 5. When the installation completes, restart Eclipse.
  67. 67. Setting up Development Environment (Contd.) Android SDK Setup (5)5. Set SDK path 1. Start Eclipse, then select Window > Preferences 2. Browse and show the path of Android SDK. 3. Press Apply and OK. Development Environment Setup is now completed!
  68. 68. Setting up Development Environment (Contd.)In Our Lab (1)In our D:// Drive we get:
  69. 69. Setting up Development Environment (Contd.)In Our Lab (2)First we install JDK We have already done that
  70. 70. Setting up Development Environment (Contd.)In Our Lab (3.1)We’ll setup Eclipse Galileo
  71. 71. Setting up Development Environment (Contd.)In Our Lab (3.2)We’ll setup Eclipse Galileo You can create a shortcut in the desktop for eclipse.exe
  72. 72. Setting up Development Environment (Contd.)In Our Lab (3.3)We’ll setup Eclipse Galileo Choose your WorkSpace
  73. 73. Setting up Development Environment (Contd.)In Our Lab (3.5)We’ll setup Eclipse Galileo You have already seen this for previous case Helios Expecting a question
  74. 74. Setting up Development Environment (Contd.)In Our Lab (3.6)We’ll setup Eclipse Galileo We’ll become familiar to our new IDE gradually and I swear you’ll start loving it
  75. 75. Setting up Development Environment (Contd.)In Our Lab (4.1)We’ll setup ADT Plugin
  76. 76. Setting up Development Environment (Contd.)In Our Lab (4.2)We’ll setup ADT Plugin
  77. 77. Setting up Development Environment (Contd.)In Our Lab (4.3)We’ll setup ADT Plugin
  78. 78. Setting up Development Environment (Contd.)In Our Lab (4.4)We’ll setup ADT Plugin
  79. 79. Setting up Development Environment (Contd.)In Our Lab (4.5)We’ll setup ADT Plugin
  80. 80. Setting up Development Environment (Contd.)In Our Lab (4.6)We’ll setup ADT Plugin
  81. 81. Setting up Development Environment (Contd.)In Our Lab (4.7)We’ll setup ADT Plugin Adding ADT Pluging is DONE… You’ll now get a message
  82. 82. Setting up Development Environment (Contd.)In Our Lab (5.1)We’ll setup android SDK After restarting Eclipse we get: Don’t forget to ask me about the red marks
  83. 83. Setting up Development Environment (Contd.)In Our Lab (5.2)We’ll setup android SDK SDK and AVD Manager: If we click on it: So, we have to set the location of Android SDK and show it to our IDE To do so….
  84. 84. Setting up Development Environment (Contd.)In Our Lab (5.3)We’ll setup android SDK
  85. 85. Setting up Development Environment (Contd.)In Our Lab (5.4)We’ll setup android SDK
  86. 86. Setting up Development Environment (Contd.)In Our Lab (5.5)We’ll setup android SDK
  87. 87. Setting up Development Environment (Contd.)In Our Lab (5.6)We’ll setup android SDK
  88. 88. Setting up Development Environment (Contd.)In Our Lab (5.6)We’ll setup DDMS Now We are Ready
  89. 89. Let’s say “Hello” to the Android World! Now that our development environment is ready, we’ll build our first Android application.In the subsequent slides:1. We’ll create an application step by step using the help of IDE and ADT.2. We’ll then explain application structure and identify the building blocks.3. We’ll experiment with components and learn to convert our innovative ideas into neat apps.
  90. 90. Let’s say “Hello” to the Android World! (Contd.)1. Start Eclipse and Go to File>New>Android Project 2. We keep project name “Hello World” (Since 1970 Ritchie’s book on C programming, programmers always say Hello World first) 3. Build Target “Android1.6” 4. Application name: “Hello World” 5. Package name: com.sentinelbd.hallo 6. Initial Activity Name: HalloActivity 7. Min SDK Version: 4 8. Click Finish Congratulations! You’ve just created your first Android application We’ll explain each input shortly
  91. 91. Let’s Go Deep…Created Project has the following structure Project Structure -Source (src) -Generated Class (gen) -Android 1.6 library -Assets (assets) -Resource(res) -drawable-hdpi -drawable-ldpi -drawable-mdpi -layout -values -AndroidMenifest.xml -default.properties
  92. 92. Let’s Go Deep… (Contd.)To run the app in emulator, we have to do the following steps:1. Create AVD (Android Virtual Device)2. Create Run Configuration3. Run the ApplicationTo run the app in device, we have to do the following steps:1. Install device driver2. Connect device through USB3. Create Run Configuration4. Run the Application We’ll run the app in emulator for now
  93. 93. Let’s Go Deep… (Contd.)1. Create AVD (Android Virtual Device)Use Android SDK & AVD Manager to create AVD
  94. 94. Let’s Go Deep… (Contd.)2. Create Run Configuration 1. Create a Run Configuration 2. Browse and select the project to run
  95. 95. Let’s Go Deep… (Contd.)3. Select AVD & Run Click Run to start AVD/emulator
  96. 96. Let’s Go Deep… (Contd.)Result in Emulator Now its time to analyze how it works
  97. 97. Project Structure…Created Project has the following structure Project Structure -Source (src) -Generated Class (gen) -Android 1.6 library -Assets (assets) -Resource(res) -drawable-hdpi -drawable-ldpi -drawable-mdpi -layout -values -AndroidMenifest.xml -default.properties
  98. 98. Project Structure (Contd.)-Source (src)We have used only one class here which is an Activity named HalloActivity. We’lldescribe about Activity in detail with lifecycle shortly. For now we can considerActivity as Android analogue for the window or dialog in a desktop application. Itcan load view from xml layout (here main.xml under res/layout folder) In the HelloActivity class the view of the Activity is set from main.xml given below
  99. 99. Project Structure (Contd.)-res/layout/main.xml 1. UI Layout can be defined from source code using View or by layout xmls. 2. The layout xml can be generated by visual tool given by ADT
  100. 100. Project Structure (Contd.)-res/drawable 1. From Android 1.6 to support different screen sizes and screen densities graphic files are kept in 3 different folders drawable-hdpi, drawable-ldpi and drawable-mdpi 2. In our current project, they contain only default icon file with different dimensions to support devices with different screen resolution.-assets Holds other static files you wish packaged with the application for deployment onto the device. In this project, we have none -gen/R.java -values/strings.xml
  101. 101. Project Structure (Contd.)-AndroidMenifest.xml XML file describing the application being built and what components – activities, services, etc. – are being supplied by that application
  102. 102. Cross-platform Development1. RhoMobile http://rhomobile.com/2. Appcelerator http://www.appcelerator.com/ 3. PhoneGap http://www.phonegap.com/
  103. 103. Resources: DVD Tutorials Day ContentDVD Content 1. Video Tutorials 2. PPT Slides EbooksTools
  104. 104. Resources: Android Developers’ Sitehttp://developer.android.com1. Tutorials & Design Guidelines2. SDK References3. Articles on Pragmatic & Good Practices4. & anything you’ll need including Google IO Videos
  105. 105. Resources: Open Source Projects1. http://code.google.com/p/apps-for-android/2. http://en.wikipedia.org/wiki/List_of_open_source_Android_applications
  106. 106. Questions?

×