Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mobile Application Development using By: Neeraj Sharma.

Similar presentations


Presentation on theme: "Mobile Application Development using By: Neeraj Sharma."— Presentation transcript:

1 Mobile Application Development using By: Neeraj Sharma

2 Basics

3 Introduction Android is a software stack for mobile devices that includes an operating system, middleware and key applications. Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language. Android is the first complete, open, and free mobile platform.

4 Introduction cont.… Android, Inc. was founded in Palo Alto, California, United States in October, 2003 by Andy Rubin (co-founder of Danger), Rich Miner (co-founder of Wildfire Communications, Inc.), Nick Sears (once VP at T-Mobile), Chris White

5 Introduction cont.… Google acquired Android Inc. in August, 2005, Making Android Inc. a wholly owned subsidiary of Google Inc. Key employees of Android Inc., including Andy Rubin, Rich Miner and Chris White, stayed at the company after the acquisition. Till May-11 Google has acquired 96 more companies

6 Open Handset Alliance Open Handset Alliance (OHA) is a business alliance of 80 firms to develop open standards for mobile devices. Member firms include Google, HTC, Sony, Dell, Intel, Motorola, Qualcomm, Texas Instruments, Samsung, LG, T-Mobil, Nvidia, and Wind River. Goal of the Open Handset Alliance is to develop open standards for mobile devices

7 Android Features Handset layouts – The platform is adaptable to larger, VGA, 2D graphics library, 3D graphics library based on OpenGL ES 2.0 specifications, and traditional smartphone layouts. Storage – SQLite, a lightweight relational database, is used for data storage purposes

8 Android Features Connectivity – Android supports connectivity technologies including GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth, Wi-Fi (no connections through Proxy server and no Ad hoc wireless network), LTE, NFC and WiMAX. Messaging – SMS and MMS are available forms of messaging, including threaded text messaging.

9 Android Features Multiple Language Support – Multiple Languages are available on Android. Web browser – The web browser available in Android is based on the open-source WebKit layout engine, coupled with Chrome's V8 JavaScript engine. Media support – WebM, H.263, H.264 (in 3GP or MP4 container), MPEG-4 SP, AMR, AMR-WB (in 3GP container), AAC, HE-AAC (in MP4 or 3GP container), MP3, MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF, BMP.

10 Android Features Streaming media support – RTP/RTSP streaming (3GPP PSS, ISMA), HTML progressive download (HTML5 tag). – Adobe Flash Streaming (RTMP) and HTTP Dynamic Streaming are supported by the Flash 10.1 plugin. – Apple HTTP Live Streaming is supported by RealPlayer for Mobile and planned to be supported by the operating system in Android 3.0 (Honeycomb). – Microsoft Smooth Streaming is planned to be supported through the awaited port of Silverlight plugin to Android.

11 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.

12 Android Market Android Market is the online software store developed by Google for Android devices. Google announced the Android Market on 28 August 2008, and it was available to users on 22 October Support for paid applications was available from 13 February 2009 for US and UK developers, with additional support from 29 countries on 30 September 2010.

13 Android Market In February 2011, the Android Market was made fully accessible on the web, allowing users to browse and pick up applications using their PCs, send them to their mobile phone and make comments on them. All this functionality was previously accessible only from mobile phone devices. Users can install apps directly using APK files, or from alternative app markets. Unlike Apple, Google allows independent app stores to operate for Android.

14 Downloading and installation of Android SDK Go to:

15 Downloading and installation of Android SDK Copy the downloaded zip file to c:\program files and unzip it.

16 Downloading and installation of Android SDK The downloaded SDK contains only basic tools that are not sufficient to develop any application therefore you must update the SDK using SDK Manager.

17 Downloading and installation of Android SDK Installing Available packages.

18 Installing the ADT Plugin for Eclipse Download ADT plugin from

19 Installing the ADT Plugin for Eclipse Go to My Eclipse Menu and click MyEclipse Configuration Center

20 Installing the ADT Plugin for Eclipse

21

22

23

24

25

26 Android Architecture

27 Linux Kernel Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack.

28 Android Runtime Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language. 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.

29 Android Runtime The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the.dex format by the included "dx" tool. The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low- level memory management.

30 Libraries Android includes a set of C/C++ libraries used by various components of the Android system. These capabilities are exposed to developers through the Android application framework.

31 Application Framework A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser. Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data. A Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files. A Notification Manager that enables all applications to display custom alerts in the status bar. An Activity Manager that manages the lifecycle of applications and provides a common navigation backstack.

32 Applications Android will ship with a set of core applications including an client, SMS program, calendar, maps, browser, contacts, and others. All applications are written using the Java programming language.

33 Dalvik Virtual Machine VS Java Virtual Machine JavaVM’s one can find on almost any desktop computer nowadays are Stack-based Virtual Machines (VM). The DalvikVM on the other hand is register based, because on mobile-processors are optimized for register-based execution. Also of register-based VMs allow faster execution times at the expense of programs which are larger after compilation.

34 Application Architecture The Android operating system is a multi-user Linux system in which each application is a different user. By default, the system assigns each application a unique Linux user ID (the ID is used only by the system and is unknown to the application). Each process has its own virtual machine (VM), so an application's code runs in isolation from other applications.

35 Application Architecture By default, every application runs in its own Linux process. Android starts the process when any of the application's components need to be executed, then shuts down the process when it's no longer needed or when the system must recover memory for other applications.

36 Application Components Application components are the essential building blocks of an Android application. There are four different types of application components. Each type serves a distinct purpose and has a distinct lifecycle that defines how the component is created and destroyed.

37 Activities An activity represents a single screen with a user interface. An activity is implemented as a subclass of Activity.

38 Services A service is a component that runs in the background to perform long-running operations or to perform work for remote processes. A service does not provide a user interface. 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.

39 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).

40 Content providers Content providers are also useful for reading and writing data that is private to your application and not shared. 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.

41 Broadcast receivers A broadcast receiver is a component that responds to system-wide broadcast announcements. Many broadcasts originate from the system for example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured.

42 Broadcast receivers A broadcast receiver is implemented as a subclass of BroadcastReceiver and each broadcast is delivered as an Intent object.

43 Managing Projects There are three types of projects, and they all share the same general structure but differ in function: – Android Project – Test Project – Library Project

44 Test Project These projects contain code to test your application projects and are built into applications that run on a device.

45 Library Project These projects contain shareable Android source code and resources that you can reference in Android projects. This is useful when you have common code that you want to reuse. Library projects cannot be installed onto a device; however, they are pulled into the.apk file at build time.

46 Set Project as Library 1.In the Package Explorer, right-click the library project and select Properties. 2.In the Properties window, select the "Android" properties group at left and locate the Library properties at right. 3.Select the "is Library" checkbox and click Apply. 4.Click OK to close the Properties window.

47 Set Project as Library

48 Referencing a Library Project To add a reference to a library project, follow these steps: 1.In the Package Explorer, right-click the dependent project and select Properties. 2.In the Properties window, select the "Android" properties group at left and locate the Library properties at right. 3. Click Add to open the Project Selection dialog. 4.From the list of available library projects, select a project and click OK. 5.When the dialog closes, click Apply in the Properties window. 6.Click OK to close the Properties window.

49 Referencing a Library Project

50 Building and Running During the build process, your Android projects are compiled and packaged into an.apk file, the container for your application binary. It contains all of the information necessary to run your application on a device or emulator. such as compiled.dex files (Dalvik byte code), a binary version of the AndroidManifest.xml file, compiled resources (resources.arsc) and uncompiled resource files for your application.

51 Building and Running In Eclipse, the ADT plugin incrementally builds your project as you make changes to the source code. Eclipse outputs an.apk file automatically to the bin folder of the project, so you do not have to do anything extra to generate the.apk.

52 Building and Running Android Debug Bridge (ADB) All Android applications must be digitally signed before the system will install them on an emulator or device. There are two ways to do this: 1.with a debug key (for immediate testing on an emulator or development device) 2.with a private key (for application distribution).

53 Creating a Sample Application Open Eclipse go to New->Android Project

54 Project Structure

55 The AndroidManifest.xml File Every application must have an AndroidManifest.xml file. The manifest presents essential information about the application to the Android system. Information the system must have before it can run any of the application's code. Among other things, the manifest does the following:

56 The 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.

57 The AndroidManifest.xml File It declares which permissions the application must have in order to access protected parts of the API and interact with other applications. It also declares the permissions that others are required to have in order to interact with the application's components. It declares the minimum level of the Android API that the application requires.

58 It lists the Instrumentation classes that provide profiling and other information as the application is running. – These declarations are present in the manifest only while the application is being developed and tested; they're removed before the application is published. it lists the libraries that the application must be linked against. The AndroidManifest.xml File

59 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. From the Eclipse Toolbar click the Android SDK and AVD Manager Button. This will open a window, from the list select “Virtual Devices”, and click New Button. AVD (Android Virtual Device)

60

61

62 User Interface and Layouts

63 View The package android.view provides classes and interfaces related to drawing on the screen. android.view.View is a high level abstraction of all views. Package android.widget provides diff. controls.

64 Layouts A layout control is still a View object. It doesn’t actually draw anything specific on the screen. It is a parent container for organizing other controls (children). It determine how and where on the screen child controls are drawn.

65 Types of Layout Linear Layout Table Layout Relative Layout Absolute Layout Frame Layout

66 View Hierarchy

67 LinearLayout

68 Linear Layout This design has 3 Linear layouts. First is the Main Container layout with vertical orientation. Then it contains 2 Linear Layouts with Vertical orientation. The second layout has 4 children. The third layout also has 4 children's.

69 Linear Layout Main Container Layout With vertical orientation Second Layout with Horizontal Orientation Third Layout with Vertical Orientation Row one Row two Row Three Row Four

70 Linear Layout

71 Load the XML Resource public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_layout); } Name of your layout file stored in res/layout folder Change this name to change layout of your activity

72 Table Layout TableLayout is a ViewGroup that displays child View elements in rows and columns.

73 Table Layout

74 Relative Layout


Download ppt "Mobile Application Development using By: Neeraj Sharma."

Similar presentations


Ads by Google