Presentation is loading. Please wait.

Presentation is loading. Please wait.

Android Platform, Android App Basic Components

Similar presentations


Presentation on theme: "Android Platform, Android App Basic Components"— Presentation transcript:

1 Android Platform, Android App Basic Components
Mobile Programming Android Platform, Android App Basic Components

2 What is Android? Android is an operating system and programming platform for smartphones and other mobile devices (such as tablets). Android includes a software development kit for writing original code and assembling software modules to create apps for Android users. It also provides a marketplace to distribute apps. All together, Android represents an ecosystem for mobile apps.

3 Android Open Source Project
Android is a widely-adopted open-source project. Owned by Open Handset Alliance Google formed a group of hardware, software, and telecommunication companies called the Open Handset Alliance with the goal of contributing to Android development.  Made up of 84 companies

4 Android Architecture

5 Contd. Applications Your apps live at this level, along with core system apps for , SMS messaging, calendars, Internet browsing, or contacts.

6 Contd. Java API Framework/Android Framework
All features of Android are available to developers through application programming interfaces (APIs) written in the Java language. Like: View System used to build an app's UI, including lists, buttons, and menus. Resource Manager used to access to non-code resources such as localized strings, graphics, and layout files. Notification Manager used to display custom alerts in the status bar. Activity Manager that manages the lifecycle of apps, etc.

7 Contd. Libraries and Android Runtime
Each app runs in its own process and with its own instance of the Android Runtime, which enables multiple virtual machines on low-memory devices. Android also includes a set of core runtime libraries. Many core Android system components and services are built from native code that require native libraries written in C and C++. These native libraries are available to apps through the Java API framework.

8 Contd. Hardware Abstraction Layer (HAL)
This layer provides standard interfaces that expose device hardware capabilities to the higher-level Java API framework. The HAL consists of multiple library modules, each of which implements an interface for a specific type of hardware component, such as the camera or bluetooth module.

9 Contd. Linux Kernel At it’s base, Android runs on a Linux kernel for interacting with the device’s processor, memory, etc. Thus an Android device can be seen as a Linux computer.

10 What is Android SDK? The Android SDK (software development kit) is a set of development tools used to develop applications for Android platform. The Android SDK includes the following: adb, the “Android Debug Bridge”, which is a connection between your computer and the device (physical or virtual). This tool is used for console output! Required libraries Debugger An emulator Relevant documentation for the Android application program interfaces (APIs) Sample source code Tutorials for the Android OS

11 What is Android NDK? Native Development Kit
The Android NDK is a toolset that lets you implement parts of your app in native code, using languages such as C and C++. For certain types of apps, this can help you reuse code libraries written in those languages.

12 What is Android Runtime?
An application runtime environment used by the Android operating system. Replacing Dalvik, the process virtual machine originally used by Android, ART performs the translation of the application's bytecode into native instructions that are later executed by the device's runtime environment. Pre-Lollipop (5.0), Android code ran on Dalvik: a virtual machine similar to the JVM used by Java SE. A developer would write Java code, which would then be compiled into JVM bytecode, which would then be translated into DVM (Dalvik virtual machine) bytecode, that could be run on Android devices. This DVM bytecode was stored in .dex or .odex (“[Optimized] Dalvik Executable”) files, which is what was loaded onto the device. Dalvik does include JIT (“Just In Time”) compilation to native code that runs much faster than the code interpreted by the virtual machine. This navite code is faster because no translation step is needed to talk to the actual hardware (the OS). From Lollipop (5.0) on, Android instead uses Android Runtime (ART) to run code. ART’s biggest benefit is that it compiles the .dex bytecode into native code on installation using AOT (“Ahead of Time”) compilation. ART continues to accept .dex bytecode for backwards compatibility (so the same dexing process occurs), but the code that is actually installed and run on a device is native. This allows for applications to have faster execution, but at the cost of longer install times—but since you only install an application once, this is a pretty good trade.

13 Building an App Write code in JAVA and XML
Generate Java source files (e.g., from resource files, which are written XML used to generate Java code) Compile Java code into JVM bytecode “dex” the JVM bytecode into Dalvik bytecode Pack in assets and graphics into an APK Cryptographically sign the APK file to verify it Load it onto the device

14 Gradle An automated build System
They let you specify a single command that will do a bunch of steps at once (e.g., compile files, dex files, move files, etc). These are how we make the “build script” that does the build steps listed above. The build system automatically takes all the source files (.java or .xml), then applies the appropriate tool (e.g. takes java class files and converts them to dex files), and groups all of them into one compressed file, our beloved APK. Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations.

15 Languages Used Java: Android code (program control and logic, as well as data storage and manipulation) is written in Java. Writing Android code will feel a lot writing any other Java program: you create classes, define methods, instantiate objects, and call methods on those objects. But because you’re working within a framework, there is a set of code that already exists to call specific methods. As a developer, your task will be to fill in what these methods do in order to run your specific application. XML: Android user interfaces and resources are specified in XML (Extensible Markup Language). XML is just like HTML, but you get to make up your own tags. Except we’ll be using the ones that Android made up; so it’s like defining web pages, except with a new set of elements. 

16 Android Application Fundamentals
Android apps can be written using Kotlin, Java, and C++ languages. The Android SDK tools compile your code along with any data and resource files into an APK, an Android package, which is an archive file with an .apk suffix. One APK file contains all the contents of an Android app and is the file that Android-powered devices use to install the app. Each Android app lives in its own security sandbox, protected by the following Android security features: The Android operating system is a multi-user Linux system in which each app is a different user. By default, the system assigns each app a unique Linux user ID (the ID is used only by the system and is unknown to the app). The system sets permissions for all the files in an app so that only the user ID assigned to that app can access them. Each process has its own virtual machine (VM), so an app's code runs in isolation from other apps. By default, every app runs in its own Linux process. The Android system starts the process when any of the app's components need to be executed, and then shuts down the process when it's no longer needed or when the system must recover memory for other apps.

17 Basic App Components

18 App Components App components are the essential building blocks of an Android app There are four basic app components: Activities Services Broadcast receivers Content providers Each type serves a distinct purpose and has a distinct lifecycle that defines how the component is created and destroyed.

19 Activity Activity is the entry point in an Android application that a user can interact with. To be more clear, an Activity is each and every single screen that you look at your Android device to interact with.

20 Services A component that runs in the background so that it can perform long, running operations or perform work for remote processes Bound Type Service Started Type Service Scheduled Type Service

21 Broadcast Receivers Broadcast Receiver” is self-explanatory. It is used to receive Broadcast Messages from the System. Let’s make it more clear, when you plug in the charger, then the charging sign will automatically get displayed on the battery icon. In whichever activity you are, when the phone is charging, then the sign will automatically come up. Let’s have another scenario, when you set alarms to give you notifications, the system will tell inform it to you in the form of a notification. Much of the broadcasting is done by the system, like when your battery is low or when the download is done or when the screen is locked, etc.

22 Content Provider Used to provide the content(data) or to access the data by other applications which is stored by itself. The most important use of content provider is that you can configure a content provider to allow other applications to securely access and modify your app data as listed in the figure.

23 Thank You!


Download ppt "Android Platform, Android App Basic Components"

Similar presentations


Ads by Google