Android Technology
-
Upload
anshul-sharma -
Category
Education
-
view
218 -
download
2
Transcript of Android Technology
What is Android?
• Google’s mobile operating system
• A free, open source mobile platform
• A Linux-based, multiprocess, multithreaded OS
• It’s not even limited to phones - you could build
a DVR, a handheld GPS, an MP3 player, etc.
• Offers an SDK and NDK
• Latest SDK version is 4.0/4.1 (Jellybean)
Software development
• Android SDK includes a comprehensive set of development tools.
• The SDK is downloadable on the android developer website.
• The officially supported integrated development environment (IDE) is Eclipse (currently 3.5 or 3.6) using the Android Development Tools (ADT) Plugin
Linux Kernel
✓ Security model: The Linux kernel handles security between the
application and the system.
✓ Memory management: The kernel handles memory management for you, leaving you free to develop your app.
✓ Process management: The Linux kernel manages processes well, allocating resources to processes as they need them.
✓ Network stack: The Linux kernel also handles network communication.
✓ Driver model: The goal of Linux is to ensure that everything works. Hardware manufacturers can build their drivers into the Linux build
Native Libraries
✓ Shared libraries all written in C or C++
✓ Compiled for the particular hardware
architecture used by the phone
✓ Preinstalled by the phone vendor
✓ Can be developed using NDK
Android Runtime
✓ Dalvik VM
– Google’s implementation of Java
– Optimized for mobile devices
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 optimized for minimal memory footprint.
Application framework
✓ Activity manager: Manages the activity life cycle.
✓ Telephony manager: Provides access to telephony services as well as some subscriber information, such as phone numbers.
✓ View system: Handles the views and layouts that make up your user interface (UI).
✓ Location manager: Finds out the device’s geographic location.
Building Blocks
✓ Activities : User Interface
✓ Intent: A mechanism for describing a specific
action
✓ Service: A task that runs in the background
without user interaction
✓ Content providers: is a set of data wrapped up
in a custom API to read and write it
Activities
✓ An activity represents a single screen with a user interface.
✓ An activity is implemented as a subclass of Activity
Intents ✓ Activities and services — are activated through messages, called intents. ✓ Intent object, is a data structure holding a description of an operation to be performed.
Implicit intents
Explicit intents
Intent intent1 = new Intent(v.getContext(), thirdscreenn.class);
startActivity(intent1);
Services
✓ A service is a component that runs in the background to perform long-running operations or to perform work for remote processes.
✓ For example, a service might play music in the background while the user is in a different application.
✓ A service is implemented as a subclass of Service.
✓ A service does not provide a user interface.
Content providers
✓ A content provider manages a shared set of application data.
✓ You can store the data in the file system, a SQLite database, on the web, or any other persistent storage location your application can access.
✓ Through the content provider, other applications can query or even modify the data (if the content provider allows it).
✓ A content provider is implemented as a subclass of ContentProvider and must implement a standard set of APIs that enable other applications to perform transactions
The AndroidManifest.xml File
✓ Every application must have an AndroidManifest.xml file.
✓ It names the Java package for the application. The package name serves as a unique identifier for the application.
✓ It describes the components of the application — the activities, services, broadcast receivers, and content providers that the application is composed of.
✓ It determines which processes will host application components.
✓ It declares the minimum level of the Android API that the application requires.
AVD (Android Virtual Device)
• An Android Virtual Device (AVD) is an emulator configuration that lets you model an actual device by defining hardware and software options to be emulated by the Android Emulator.
Listeners
✓ Tell Android which object to callback when the user touches or clicks the view✓ Use setOnClickListener() method that needs to Be passed an object that implements the OnClickListener Java interface✓ Set android:onClick property with the method name that handles the click action
button.setOnClickListener(new OnClickListener(){
public void onClick(View v) {// TODO Auto-generated method stubIntent j = new Intent(v.getContext(),mediaplayer.class);j.putExtra(mediaconstant.MEDIA_MODE, mediaconstant.MEDIA_PAUSE);startService(j);}} );