Introduction To Android
Mobile Technologies Symbian OS ios BlackBerry OS Windows Android
Introduction to Android Android is an operating system for mobile devices such as smart phones and tablet computers. It is developed by the Open Handset Alliance led by Google. Android is a mobile operating system that is based on a modified version of Linux.
OHA (Open Handset Alliance) A business alliance consisting of 47 companies to develop open standards for mobile devices
Introduction Google wanted Android to be open and free; hence, most of the Android code was released under the open source Apache License. Different vendors design their own hardware and use Android as the operating system that powers it. Developers need only develop for Android, and their applications should be able to run on numerous different devices which are powered using Android.
Android Versions Android Version Release Date Code Name 1.1 9 th Feb 2009 1.5 30 th April 2009 Cupcake 1.6 15 th September 2009 Donut 2.0 / 2.1 26 th October 2009 Éclair 2.2 20 th May 2010 Froyo 2.3 6 December 2010 Gingerbread 3.0 / 3.1 / 3.2 22 nd Feb 2011 Honeycomb 4.0 19 th October 2011 Ice Cream Sandwich 4.1 / 4.2 / 4.3 27 th June 2012 Jelly Bean 4.4 3 rd September 2013 Kitkat 5.0 2014 Lollipop 6.0 2015 Marshmallows 7.0 22 nd August 2016 Nougat
Features of Android Storage : Uses SQLite Connectivity : Supports GSM/EDGE, Bluetooth, Wi-Fi etc Messaging : Supports SMS, MMS Web browser : Based on the open source WebKit + Chrome Media support : MP3, MP4, WAV, JPEG, etc Hardware support : Accelerometer Sensor, Camera, Digital Compass, Proximity Sensor, and GPS
Features of Android Multi-touch : Supports multi-touch screens Multi-tasking : Supports multi-tasking applications Flash support : Android 2.3 supports Flash 10.1. Tethering : Supports sharing of Internet connections as a wired/wireless hotspot
Android Architecture The Android OS is roughly divided into five sections in four main layers: Linux kernel Libraries Android runtime Application framework Applications
Android Architecture
Android Architecture Linux kernel This is the kernel on which Android is based. This layer contains all the low level device drivers for the various hardware components. Libraries These contain all the code that provides the main features of an Android OS. SQLite library provides database support. WebKit library provides functionalities for web browsing.
Android Architecture Android runtime Android runtime provides a set of core libraries that enable developers to write Android apps using the Java programming language. It includes the Dalvik Virtual Machine, which enables every Android application to run in its own process with its own instance of the Dalvik virtual machine. Dalvik is a specialized virtual machine designed specifically for Android and optimized for battery-powered mobile devices with limited memory and CPU
Android Architecture Application framework Exposes the various capabilities of the Android OS to application developers so that they can make use of them in their applications. Applications At this top layer, you will find applications that ship with the Android device, as well as applications that you download and install from the Android Market
Obtaining The Required Tools JAVA JDK The Android SDK makes use of the Java SE Development Kit (JDK). Android SDK The Android SDK contains a debugger, libraries, an emulator, documentation, sample code, and tutorials. Eclipse ANDROID STUDIO
Dalvik Virtual Machine The Dalvik Virtual Machine (DVM) is an android virtual machine optimized for mobile devices. Optimizes the virtual machine for memory, battery life and performance. The Dex compiler converts the class files into the.dex file that run on the Dalvik VM. Multiple class files are converted into one dex file.
Dalvik Virtual Machine The javac tool compiles the java source file into the class file. The dx tool takes all the class files of your application and generates a single.dex file. It is a platform-specific tool. The Android Assets Packaging Tool (aapt) handles the packaging process.
Dalvik Virtual Machine
Dalvik Virtual Machine Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimised for minimal memory footprint.
Android Application package Android Package Kit (APK) is the package file format used by the Android OS for distribution and installation of mobile apps. To make an APK file, a program for Android is first compiled, and then all of its parts are packaged into one file. An APK file contains all of that program's code (such as.dex files), resources, assets, certificates, and manifest file. As is the case with many file formats, APK files can have any name needed, provided that the file name ends in ".apk"
ECCLIPSE INSTALLATION
Configuring The Android SDK Manager
Configuring The Android SDK Manager Each version of the Android OS is identified by an API level number. For each level, two platforms are available. SDK Platform Google APIs by Google Inc. Google APIs platform contains additional APIs provided by Google (such as the Google Maps library).
Configuring The Android SDK Manager
Creating Android Virtual Devices (Avds)
Creating Android Virtual Devices (Avds)
Creating Android Virtual Devices (Avds)
Creating Your First Android Application Using Eclipse, create a new project by selecting File New Project
Creating Your First Android Application
Creating Your First Android Application
Creating Your First Android Application
Creating Your First Android Application
Creating Your First Android Application
Creating Your First Android Application
Anatomy Of An Android Application Source code String constants Auto-generated code Configuration UI layout
Anatomy Of An Android Application src: Contains the.java source files for your project You write the code for your application in this file. gen: Contains the R.java file, a compiler-generated file that references all the resources found in your project. All the resources in your project are automatically compiled into this class so that you can refer to them using the class.
Anatomy Of An Android Application assets: This folder contains all the assets used by your application, such as HTML, text files, data bases, etc. bin: This folder contains the files built by the ADT during the build process. In particular, it generates the.apk file (Android Package). An.apk file is the application binary of an Android application. It contains everything needed to run an Android application.
Anatomy Of An Android Application res: This folder contains all the resources used in your application. It also contains a few other subfolders: drawable- <resolution>, layout, and values. AndroidManifest.xml: This is the manifest file for your Android application. Here you specify the permissions needed by your application, as well as other features (such as intent-filters, receivers, etc.).
Anatomy Of An Android Application main.xml file defines the user interface for your activity. <TextView android:layout_width= fill_parent android:layout_height= wrap_content android:text= @string/hello /> The @string in this case refers to the strings.xml file located in the res/values folder. @string/hello refers to the hello string defined in the strings.xml file, which is Hello World, HelloWorldActivity! :
Anatomy Of An Android Application strings.xml: <?xml version= 1.0 encoding= utf-8?> <resources> <string name= hello >Hello World, HelloWorldActivity!</string> <string name= app_name >HelloWorld</string> </resources> It is recommended that you store all the string constants in your application in this strings.xml file and reference these strings using the @string identifier.
Anatomy Of An Android Application AndroidManifest.xml:
AndroidManifest.xml The AndroidManifest.xml file contains information of your package, including components of the application such as activities, services, broadcast receivers, content providers etc. It is responsible to protect the application to access any protected parts by providing the permissions. It also declares the android api that the application is going to use. This is the required xml file for all the android application and located inside the root directory.
Elements of AndroidManifest.xml <manifest> : Manifest is the root element of the AndroidManifest.xml file. It has package attribute that describes the package name of the activity class. <application> : Application is the sub-element of the manifest. It includes the namespace declaration. This element contains several sub-elements that declares the application component such as activity etc. The commonly used attributes are of this element are icon, label, theme etc.
Elements of AndroidManifest.xml <activity> : Activity is the sub-element of application and represents an activity that must be defined in the AndroidManifest.xml file. It has many attributes such as label, name, theme, launch Mode etc. android:label represents a label i.e. displayed on the screen. android:name represents a name for the activity class. It is required attribute. <intent-filter> : Intent Filter is the sub-element of activity that describes the type of intent to which activity, service or broadcast receiver can respond to.
Elements of AndroidManifest.xml <action> : It adds an action for the intent-filter. The intent-filter must have at least one action element. The action for the intent filter is named android.intent.action.main to indicate that this activity serves as the entry point for the application. <category> : It adds a category name to an intentfilter. The category for the intent-filter is named android.intent.category.launcher to indicate that the application can be launched from the device s launcher icon.
Anatomy Of An Android Application HelloWorldActivity.java: import android.app.activity; import android.os.bundle; public class HelloWorldActivity extends Activity { /** Called when the activity is first created. */ @Override public void oncreate(bundle savedinstancestate) { } super.oncreate(savedinstancestate); setcontentview(r.layout.main); }
ANDROID STUDIO
Installing Android Studio
Installing Android Studio
Installing Android Studio
Installing Android Studio
Installing Android Studio
Creating Android Virtual Device AVD Manager
Creating Android Virtual Device
Creating Android Virtual Device
Creating Android Virtual Device
Creating Android Virtual Device
Basic Building Blocks Activities Services Broadcast Receivers Content providers
Activity The building block of the user interface is the Activity. You can think of an activity as being the Android analogue for the window or dialog in a desktop application, or the page in a classic Web app. Normally, an activity will take up most of the screen, leaving space for some chrome bits like the clock, signal strength indicators, and so forth.
Activity
Services Activities are short-lived and can be shut down at any time, such as when the user presses the BACK button. Services, on the other hand, are designed to keep running, if needed, independent of any activity, for a short period of time. You might use a service for checking for updates to an RSS feed, or to play back music even if the controlling activity is no longer operating.
Content Providers Content providers provide a level of abstraction for any data stored on the device that is accessible by multiple applications. The Android development model encourages you to make your own data available to other applications, as well as your own building a content provider lets you do that, while maintaining a degree of control over how your data gets accessed.
Broadcast Receivers The system, or applications, will send out broadcasts from time to time, for everything from the battery getting low, to when the screen turns off, to when connectivity changes from WiFi to mobile data. A broadcast receiver can arrange to listen for these broadcasts and respond accordingly.
THE END