Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android App Development

Android App Development

Rajiv Manivannan

March 23, 2018
Tweet

More Decks by Rajiv Manivannan

Other Decks in Programming

Transcript

  1. • Applications: It is the top layer in the Android

    stack.All apps will be installed here. • Application Framework: It provides many higher-level services to applications in the form of Java classes. Application developers are allowed to make use of these services in their applications. • Android Runtime: It provides a key component called Dalvik Virtual Machine which is a kind of Java Virtual Machine specially designed and optimised for Android. • Android Libraries: This category encompasses those Java-based libraries that are specific to Android development.It include the application framework libraries in addition to those that facilitate user interface building, graphics drawing and database access. • Core Libraries: It including open-source Web browser engine WebKit, well known library libc, SQLite database, libraries to play and record audio and video, SSL libraries responsible for Internet security etc. • Linux kernel: This provides a level of abstraction between the device hardware and it contains all the essential hardware drivers like camera, keypad, display etc.
  2. Application Fundamentals • Android apps are written in the Java

    programming language. 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. Android-powered devices use to install the app. • 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.
  3. Prerequisite • Android Studio is the official IDE for android

    development. • Android SDK that enables developers to create applications for the Android platform. • You can download the both as bundle from https:// developer.android.com • JAVA SDK we write code in Java and use some JDK tools in the app development.
  4. Development Workflow • Setup: Download the Android SDK bundle and

    setup the environment. • Write: Create project, write code and add required assets in the project. • Build & Run: Using Build tools your can build and run the app in device or emulator. • Iterate: Using Platform tools you can debug and test your app. • Publish: Create a Google Play Developer Account ($25) and Publish the App.
  5. Android SDK • Android SDK provides necessary tool to build,

    test, and debug apps for Android powered devices. • It includes sample projects with source code, SDK Tools, Platform Tools, Build Tools and an emulator, and required libraries to build Android applications.
  6. SDK Tools • sdkmanager: Allows you to view, install, update,

    and uninstall packages for the Android SDK. • avdmanager: Allows you to create and manage Android Virtual Devices (AVDs). • emulator: A QEMU-based device-emulation tool that you can use to debug and test your applications in an actual Android run-time environment. • mksdcard: Helps you create a disk image that you can use with the emulator, to simulate the presence of an external storage card (such as an SD card).
  7. Platform Tools • adb: Android Debug Bridge (adb) is a

    versatile tool that lets you manage the state of an emulator instance or Android-powered device. You can also use it to install an APK on a device. • fastboot: To flashes a device with platform and other system images. • Android Device Monitor: A standalone tool that provides a UI for several Android application debugging and analysis tools.
  8. • Dalvik Debug Monitor Server (DDMS):It provides port-forwarding services, screen

    capture on the device, thread and heap information on the device, logcat, process, and radio state information, incoming call and SMS spoofing, location data spoofing, and more. • Systrace: To analyse the UI performance. • Hierarchy Viewer: To profile the layouts.
  9. Build Tools • dx tool: It converts Java class files

    into a .dex (Dalvik Executable) file. • apksigner: Signs APKs and checks whether APK signatures will be verified successfully on all platform versions that a given APK supports. • zipalign: Optimizes APK files by ensuring that all uncompressed data starts with a particular alignment relative to the start of the file. • Android Asset Packaging Tool: It allows you to view, create, and update Zip-compatible archives (zip, jar, apk). It can also compile resources into binary assets.
  10. Gradle Build System • Gradle is a build automation system.It

    can automate building, testing, publishing and deployment of app. • It combines the power and flexibility of the Ant with the dependency management and conventions of Maven into more effective way to build. • Gradle build files use a Domain Specific Language or DSL Groovy Language to define custom build logic and to interact with the Android-specific elements of the Android plugin for Gradle.
  11. Project Structure • app: Our project module. • build.gradle: Config

    file to declare the required dependencies and custom build logic. • libs: Where the *.jar & *.aar library files resides. • src: Where our source code and project assets resides. • AndroidManifest.xml: Config file to declare the app component and required user permission for the app.
  12. The Build Process • Gradle take care of the build

    process.It execute the build based on the build logic written in the *.gradle file. • Application module and Dependencies are compiled by the dx complier. • Source code will be compiled into classes.dex file format. • Apksigner tool digitally sign the APK with debug/release keystore certificate. • Android packing tool (APT) pack the *.dex files and compiled resources into single installable file called Android Package (APK).
  13. App Components • Application components are the essential building blocks

    of an Android application. These components are loosely coupled by the application manifest file AndroidManifest.xml that describes each component of the application and how they interact. • There are four different types of App Components: Activity, Service, Broadcast Receiver and Content providers.
  14. Activity An activity is the entry point for interacting with

    the user. It represents a single screen with a user interface.
  15. Service • Service is to perform long-running operations in the

    background, and it does not provide a user interface. • Another application component can start a service, and it continues to run in the background even if the user switches to another application. • Additionally, a component can bind to a service to interact with it and even perform interprocess communication (IPC).
  16. Broadcast Receiver • A broadcast receiver (receiver) is which allows

    you to register for system or application events. • All registered receivers for an event are notified by the Android runtime once this event happens.
  17. Content Provider • Content providers can help an application manage

    access to data stored by itself, stored by other apps, and provide a way to share data with other apps. • They encapsulate the data, and provide mechanisms for defining data security. • Content providers are the standard interface that connects data in one process with code running in another process.
  18. Intents • An Intent is a messaging object you can

    use to request an action from another app component. • Using intent can communicate data object between components. • Using intent can start an activity or service. Also can delivering broadcast.
  19. Android - UI • Android UI is defined in an

    xml file. During compilation, each element in the XML is compiled into equivalent Android GUI class with attributes represented by methods. • View: A View is just a widget that appears on the screen. It could be textview, editText, button etc., • ViewGroups: A ViewGroup is a special view that can contain other views.The view group is the base class for layouts and views containers.Eg: Relative layout,Linear layout etc., • XML attributes: Every View and ViewGroup object supports their own variety of XML attributes.It is used to specify and set property to the Views and ViewGroups.Like width, height, padding, margin and size etc., • Measurement units: For layout, measurement units will be represent in dp (Density-independent Pixels) and for font unit is sp (Scale-independent Pixels).
  20. AndroidManifest.xml • Every application must have an AndroidManifest.xml file (with

    precisely that name) in its root directory. The manifest file provides essential information about your app to the Android system, which the system must have before it can run any of the app's code. • It names the package for the application. The package name serves as a unique identifier for the application. • It describes the components of the application, which include the activities, services, broadcast receivers, and content providers that compose the application.
  21. Kotlin • Kotlin is now official language for Android development.

    • It combine the Best of Functional and Procedural Programming concepts. • Multi-platform: Gradle supports Kotlin you can write your *.gradle file in Kotlin. Not only for Android development Kotlin JS is released you can develop front-end apps too.