Programming Mobile Applications with Android 22-26 September, Albacete, Spain Jesus Martínez-Gómez
Programming Mobile Applications with Android Lesson 1.- Introduction to Android Introduction Android development requirements.- What do we need to develop Android applications Setup of Android SDK Introduction to the emulator.- Advantages and disadvantages First View to an android application Android Manifest File.- Permissions management Android Lab I.- Hello World OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Lesson 1.- Introduction to Android In this lesson we will learn Why to develop in Android ? What do we need to develop Android applications? How to setup the environment for development ? When and how to use the emulator? What is the manifest file and what are the main permissions? OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android What is Android? Software Platform and a Operative System for mobile devices Based in the Linux kernel Allows to code in Java, but also in other languages thanks to the use of native ARM code Lot of libraries, development tools and documentation OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Why Android? Approximately … 90% of smartphones are based on the use of Android Open Source → Huge number of developers Open Handset Alliance Google, Asus, Garmin, Toshiba, ebay, nvidia, huawei, sony, samsung, intel … Easy to use OSSCOM Programming Mobile Applications with Android
OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Main Android Alternatives? iphone Operative System iOS Blackberry Windows Phone Other alternatives ? Firefox OS Symbian Phone Gap OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Phone Gap (http://phonegap.com/) Source code: HTML, CSS and JavaScript Cross-platform The same application can be released for Android Windows Phone iPhone Blackberry OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android What is included in Android? Application Framework Libraries Android Runtime HAL Applications Kernel OSSCOM Programming Mobile Applications with Android
OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Android … some history Founded in 2003 Andy Rubin, Rich Miner, Nick Sears and Chris White Acquired by Google in the Summer of 2005 Open Handset Alliance is established in 2007 Android 1.0 was released on September 23, 2008 Since 2010, Nexus series of devices Lot of versions and updates OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Android versions Each new version of android uses the name of some well-known sweets Main differences between versions API level Widgets and libraries Video and audio support Keyboard Communication OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Android versions (main releases) Android 1.5 Cupcake Video record and display Android 1.6 (Donut) VPN support and different display resolutions Android 2.2 (Froyo) Flash and external storage Android 3.0 (Honeycomb) Specific for tablet devices Android 4.0 (Ice Cream Sandwich) OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Environment setup Eclipse Android Development Toolkit Plugin Android Virtual Device Manager (Emulator) Smartphone For real tests OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Environment setup Installation Prerequisites Java Development Kit JDK6 Development environment for building applications, applets, and components using the Java programming language. http://www.oracle.com/technetwork/java/javase/downloads/in dex.html OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Environment setup Download the Android Developer Tools that includes: Eclipse + ADT Plugin Android SDK tools Android Platform tools A version of the Android Platform A version of the Android system image for the emulator https://developer.android.com/sdk/index.html OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Unzip the downloaded file into your file system Eclipse folder SDK folder Open the eclipse folder and execute eclipse We must obtain ... OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Android SDK Manager AVD Manager (emulator) OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android SDK Manager OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android AVD Manager OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android AVD Manager Only those options previously installed Problem !! OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android SDK Manager We will open it again to install the proposed required packages, and new ones including ... OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android AVD Manager We can now create a new device OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Debugger is another interesting tool for Android development We can access in real-time to the real value of the application internal parameters Very useful to find the origin of application errors We can both debug applications running on the emulator or the physical smartphone Follow the instruction to install the drivers and set your device for evaluation http://developer.android.com/tools/device.html OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Thanks to the emulator, we can Evaluate our applications using different platforms Test non-stable applications Emulate locations , battery levels, SMS or calls … but on the contrary Development is very slow Some characteristics cannot be emulated OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Any android project consist of Sources folder → src Source code for our programming files Java classes Generated files → gen Files are generated automatically Resources folder → res Layouts, images, sounds, text strings, etc Android Manifest file Configuration and requirements of the application OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Let's all create our first Android application New → Android Application Project We will establish the options for Android 4.2 OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Let's all create our first Android application We can see on the left all the files that have been created automatically Please open the manifest OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android AndroidManifest.xml 2 different views: source code and options (permissions, application, instrumentation) OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android First Android application Source code and visual interfaces are separated Source Code: .java files located in /src Visual Interfaces: layout files located in /res/layout Out first application will consist of a single screen with our name → No modification in the behavior Please open the layout file (activity_main.xml) OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android First Android application Source code and visual interfaces are separated Source Code: .java files located in /src Visual Interfaces: layout files located in /res/layout Out first application will consist of a single screen with our name → No modification in the behavior Please open the layout file (activity_main.xml) We have two views: graphical layout and xml source OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android First Android application In the layout file, please select the area with the label hello world … and change the text with your desired phrase OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android First Android application Now we will prepare a emulator for its execution From the Android SDK Manager, please install the options from the 4.1 (Api 16) Once all the packages have been installed (several steps can be required), restart Eclipse Open the Android Virtual Device Manager, create a new one with the following configuration Name: Nexus7Api16, Device: Nexus 7 Target: Android 4.1.2 OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android First Android application: execution Now, we will run our application Right button over the project → Run As → Android Application We now find a window to select where to execute the application Smartphone → if plugged and configured properly Emulator → we need to load OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android First Android application: execution OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android First Android application Execution OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Android Manifest File Configuration file that describes the application Permissions that are requested Access to the Internet, Camera, external storage Minimum version of SDK for execution Name and logo of the application Activities (Windows) including the main one Libraries and features used Other OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Android Manifest File Main changes that should be applied: permissions Can be added using the GUI or directly my modifying the code Basic permissions android.permission.WRITE_EXTERNAL_STORAGE android.permission.INTERNET android.permission.CAMERA android.permission.SEND_SMS android.permission.ACCESS_COARSE_LOCATION ... OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Android Manifest File The list of required permission will be listed when the application is being installed Include just the permissions that are needed OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android Lesson 1.- Introduction to Android Android Lab I.- Create, compile and execute a hello world application Follow the instructions to prepare your computer for development Create a new application and discover all the options that are available Execute the application both in the emulator and your mobile phone OSSCOM Programming Mobile Applications with Android
Programming Mobile Applications with Android 22-26 September, Albacete, Spain Jesus Martínez-Gómez OSSCOM Programming Mobile Applications with Android