Android Pratical

Android Pratical 


Q:1. What is Android and it's architecture. 

What is Android


 Android is a software package and linux based operating system for mobile devices such as tablet computers and smartphones.

It is developed by Google and later the OHA (Open Handset Alliance). Java language is mainly used to write the android code even though other languages can be used.

The goal of android project is to create a successful real-world product that improves the mobile experience for end users.

Android Architecture :- 

 Android architecture contains different number of components to support any android device needs. Android software contains an open-source Linux Kernel having collection of number of C/C++ libraries which are exposed through an application framework services.

Among all the components Linux Kernel provides main functionality of operating system functions to smartphones and Dalvik Virtual Machine (DVM) provide platform for running an android application.

The main components of android architecture are following:-

  • Applications
  • Application Framework
  • Android Runtime
  • Platform Libraries
  • Linux Kernel

Pictorial representation of android architecture with several main components and their sub components –

Applications –

Applications is the top layer of android architecture. The pre-installed applications like home, contacts, camera, gallery etc and third party applications downloaded from the play store like chat applications, games etc. will be installed on this layer only.
It runs within the Android run time with the help of the classes and services provided by the application framework.

Application framework –

Application Framework provides several important classes which are used to create an Android application. It provides a generic abstraction for hardware access and also helps in managing the user interface with application resources. Generally, it provides the services with the help of which we can create a particular class and make that class helpful for the Applications creation.

It includes different types of services activity manager, notification manager, view system, package manager etc. which are helpful for the development of our application according to the prerequisite.

Application runtime –

Android Runtime environment is one of the most important part of Android. It contains components like core libraries and the Dalvik virtual machine(DVM). Mainly, it provides the base for the application framework and powers our application with the help of the core libraries.

Like Java Virtual Machine (JVM), Dalvik Virtual Machine (DVM) is a register-based virtual machine and specially designed and optimized for android to ensure that a device can run multiple instances efficiently. It depends on the layer Linux kernel for threading and low-level memory management. The core libraries enable us to implement android applications using the standard JAVA or Kotlin programming languages.

Platform libraries –

The Platform Libraries includes various C/C++ core libraries and Java based libraries such as Media, Graphics, Surface Manager, OpenGL etc. to provide a support for android development.

  • Media library provides support to play and record an audio and video formats.
  • Surface manager responsible for managing access to the display subsystem.
  • SGL and OpenGL both cross-language, cross-platform application program interface (API) are used for 2D and 3D computer graphics.
  • SQLite provides database support and FreeType provides font support.
  • Web-Kit This open source web browser engine provides all the functionality to display web content and to simplify page loading.
  • SSL (Secure Sockets Layer) is security technology to establish an encrypted link between a web server and a web browser.

Linux Kernel –

Linux Kernel is heart of the android architecture. It manages all the available drivers such as display drivers, camera drivers, Bluetooth drivers, audio drivers, memory drivers, etc. which are required during the runtime.

The Linux Kernel will provide an abstraction layer between the device hardware and the other components of android architecture. It is responsible for management of memory, power, devices etc.

The features of Linux kernel are:

  • Security: The Linux kernel handles the security between the application and the system.
  • Memory Management: It efficiently handles the memory management thereby providing the freedom to develop our apps.
  • Process Management: It manages the process well, allocates resources to processes whenever they need them.
  • Network Stack: It effectively handles the network communication.
  • Driver Model: It ensures that the application works properly on the device and hardware manufacturers responsible for building their drivers into the Linux build.

Q:2.All the version of Android


Android Versions

The development of the Android operating system was started in 2003 by Android, Inc. Later on, it was purchased by Google in 2005. The beta version of Android OS was released on November 5, 2007, while the software development kit (SDK) was released on November 12, 2007.

The first Android mobile was publicly released with Android 1.0 of the T-Mobile G1 (aka HTC Dream) in October 2008.

Google announced in August 2019 that they were ending the confectionery scheme, and they use numerical ordering for future Android versions.

The first Android version which was released under the numerical order format was Android 10.

Android versions, name, and API level

Code nameVersion numbersAPI levelRelease date
No codename1.01September 23, 2008
No codename1.12February 9, 2009
Cupcake1.53April 27, 2009
Donut1.64September 15, 2009
Eclair2.0 - 2.15 - 7October 26, 2009
Froyo2.2 - 2.2.38May 20, 2010
Gingerbread2.3 - 2.3.79 - 10December 6, 2010
Honeycomb3.0 - 3.2.611 - 13February 22, 2011
Ice Cream Sandwich4.0 - 4.0.414 - 15October 18, 2011
Jelly Bean4.1 - 4.3.116 - 18July 9, 2012
KitKat4.4 - 4.4.419 - 20October 31, 2013
Lollipop5.0 - 5.1.121- 22November 12, 2014
Marshmallow6.0 - 6.0.123October 5, 2015
Nougat7.024August 22, 2016
Nougat7.1.0 - 7.1.225October 4, 2016
Oreo8.026August 21, 2017
Oreo8.127December 5, 2017
Pie9.028August 6, 2018
Android 1010.029September 3, 2019
Android 111130September 8, 2020

Android Version 1.0 to 1.1: No codename

Android officially publish its Android version 1.0 in September 2008. It is the initial version of Android operating system. It supports Web browser to show HTML and XHTML web pages, camera, access web email server (POP3, IMAP4, and SMTP). This version contains Google Calendar, Google Maps, Google Sync, Google Search, Google Talk, Instant messaging, Media player, Notifications appear in the status bar, wallpaper, YouTube video player, Alarm Clock, Calculator, Dialer, Pictures (Gallery), Wi-Fi and Bluetooth support.

Android version 1.5: Cupcake

On April 27, 2009, the Android updated to 1.5 with the codename of the dessert item (Cupcake). It has Linux kernel 2.6.27. It supports third-party virtual keyboard, Video recording and playback in MPEG-4, Copy and paste feature, Animated screen translations, auto-rotation option, ability to upload a video to YouTube, upload photos to Picasa, check phone usage history.

Android version 1.6: Donut

On September 15, 2009, Android 1.6 was released with the name Donut. It contains numerous new features such as voice and text entry search, bookmark history, contacts, web, "speak" a string of text, faster camera access, user can select multiple photos for deletion, support text-to-speech engine, WVGA screen resolutions.

Android version 2.0 to 2.1: Eclair

On October 26, 2009, Android 2.0 was released, whose codename was Eclair. It was based on Linux kernel 2.6.29. It contains the several new features as expanded account sync, Microsoft Exchange email support, Bluetooth 2.1, ability to tap a Contact photo and select to call, SMS, ability to search all saved SMS, MMS messages, delete the oldest message automatically when the defined limit is reached, Minor API, bug fixes.

Android version 2.2 to 2.2.3: Froyo

On May 20, 2010, Android 2.2 (Froyo) was released based on Linux kernel 2.6.32. It contains several features as speed, memory, performance optimization. JIT compilation, Integration of Chrome's V8, JavaScript engine into the Browser application, support Android Cloud to Device Messaging service, Adobe Flash support, security updates, and performance improvement.

Android version 2.3 to 2.3.7: Gingerbread

On December 6, 2010, the Android 2.3 (Gingerbread) was released based on Linux kernel 2.6.35. It includes the following changes: support for extra-large screen size and resolutions, updated user interface design with increased simplicity and speed, enhanced copy/paste functionality, select a word by press-holding, support Near Field Communication (NFC), headphone virtualization, new Download Manager.

It has improved bug fixes for Nexus S, voice or video chat using Google Talk, network performance for Nexus S 4G, Gmail application, battery efficiency, fixed a voice search bug, Google Wallet support for Nexus S 4G.

Android version 3.0 to 3.2.6: Honeycomb

On February 22, 2011, Android 3.0 (Honeycomb) was launched for the first tablet for Android-based on Linux kernel 2.6.36. It contains the features like "holographic" user interface for tablet, added system Bar, simplified multitasking tapping Recent Application in system Bar, redesign the keyboard making fast typing, quick access to camera exposure, hardware acceleration, support for multi-core processor, UI refinements, connectivity for USB accessories, support for joysticks and gamepads, high-performance Wi-Fi lock, improved hardware support, Google Books, fixed data connectivity issues when coming out of Airplane mode.

Android version 4.0 to 4.0.4: Ice Cream Sandwich

On October 19, 2011, Android 4.0.1 (Ice Cream Sandwich) was launched, which was based on Linux kernel 3.0.1. It was the last version of officially support Adobe System Flash player. It introduces the numerous new features: refinements to "Holo" interface with new Roboto font family, separation of widgets in a new tab, integrated screenshot capture, improved error correction on the keyboard, improved copy and paste functionality, build-in photo editor, fixed minor bugs, improvement to graphics, spell-checking, better camera performance.

Android version 4.1 to 4.3.1: Jelly Bean

On June 27, 2012, Google announced Android 4.1(Jelly Bean) in the Google I/O conference. It is based on Linux kernel 3.0.31. It updates to following features: smoother user interface, enhance accessibility, expandable notification, fixed bug on Nexus 7, one-finger gestures to expand/collapse notifications, lock screen improvement, multiple user accounts (tablets only), new clock application, Bluetooth low energy support, volume for incoming call, 4K resolution support, native emoji support, bug fixes for the Nexus 7 LTE.

Android version 4.4 to 4.4.4: KitKat

On September 3, 2013, Google announced Android 4.4 (KitKat). Initially, its code name was "Key Lime Pie". Google started on Google's Nexus 5 on October 31, 2013. The minimum required amount of RAM should available to Android is 340 MB. The other devices with less than 512 MB of RAM must report themselves as "low RAM" devices. It includes several new features as clock no longer display bold hours, wireless printing capability, WebViews are based on Chromium engine, sensor batching, built-in screen recording feature, better application compatibility, camera application loads Google+ Photo instead of Gallery.

Android version 5.0 to 5.1.1: Lollipop

Android 5.0 "Lollipop" was initially named "Android L" on June 25, 2014. It was officially introduced on November 12, 2014. Lollipop provides several features like redesigned user interface, support for 64-bit CPUs, support for print previews, material design, Project Volta for battery life improvement, multiple user accounts, audio input, and output through USB devices, join Wi-Fi networks, support for multiple SIM cards, device protection, high-definition voice calls, native Wi-Fi calling support.

Android version 6.0 - 6.0.1: Marshmallow

Android 6.0 "Marshmallow" was disclosed under the codename "Android M" on May 28, 2015, for Nexus 5 and Nexus 6 phones, Nexus 9 tablet.

On October 5, 2015, Android lunches "Marshmallow" for all android devices. It contains the various new features as App Standby feature, introduce the Doze mode to save battery life, native fingerprint reader support, run-time permission requests, USB-C support, Unicode 7.0 & 8.0 emoji support.

Android version 7.0 to 7.1.2: Nougat

Android 7.0 "Nougat" was the major release for the Android operating system. Its initial codename was "Android N". It was first released as a developer preview on March 9, 2016, with factory images for the Nexus device.

On August 22, 2016, the final preview built was released with following features: file-based encryption, zoom in the screen, multi-window support, new Data Saver mode, JIT compiler makes 75 percent faster app installation, picture-in-picture support, support manager APIs, circular app icons support, send GIFs directly from the default keyboard, battery usage alerts.

Android version 8.0 to 8.1: Oreo

Android 8.0 "Oreo" was the 8th major release of the Android operating system. It was first released for developer preview on March 21, 2017. The final developer preview was released on July 24, 2017.

On August 21, 2017, its stable version was released with several features: picture-in-picture support, support for Unicode 10.0 emoji (5.0), restructured settings, adoptive icons, notification channels, notification dots, 2 times faster boot time, Google Play Protect, Integrated printing support, Neural network API, shared memory API, Android Oreo Go Edition, autofill framework, automatic light, and dark themes.

Android version 9.0: Pie

Android 9.0 "Pie" was the ninth major version of the Android operating system. It was first announced and preview launched by Google on March 7, 2018. It was officially released on August 6, 2018. It has the following features: the clock has moved to the left of the notification bar, the "screenshot" button has been added, battery percentage always shown on display.

Android version 10:

Android 10 is the tenth extensive version of the Android operating system. Android 10 has developed under the codename "Android Q". It was initially announced by Google on March 13, 2019 and its first beta version was released on same day and its second beta was released on April 3, 2019.

The stable version of Android 10 was released on September 3, 2019. It contains features like new permissions to access location in the background, floating setting panel, support for an AV1 video codec, support for biometric authentication, support the WPA3 Wi-Fi security.

Android 11

Android 11 operating system is the eleventh big release of Android. It is the 18th version of Android mobile OS, which was released on 8 September 2020. The alphabetic naming system of Android, based on deserts, was stopped since Android 10. So therefore, this operating system has branded with "Android 11".

Features included in Android 11

  • Conversations: Get all your message in one place.
  • Accessibility: Perceptive apps help us to control and navigate our phone using voice command.
  • Device controls: Android 11 allows us to control all our connected devices (IOT) from a single point.
  • Content capture: Android 11 comes with a screen recording feature that captures our phone's current screen activity.
  • Predictive tools: By predicting our habits and patterns of working, it suggests accordingly.
  • Privacy & security: Android 11 gives more security and privacy fixes to our smartphone straight from Google Play.
  • Media: We can play music from other devices connected to our phones.


Q:3. Advantages and disadvantages of using Android


Advantages:


1. **Open Source**: Android is open-source, which allows for greater customization and flexibility for developers and users.
2. **Variety of Devices**: Android runs on a wide range of devices, from budget smartphones to high-end tablets, offering options to fit different needs and budgets.
3. **Customization**: Users can personalize their Android devices with custom launchers, widgets, and themes, giving them more control over their user experience.
4. **Integration with Google Services**: Android seamlessly integrates with Google services such as Gmail, Google Drive, and Google Maps, providing a cohesive ecosystem for users.
5. **App Ecosystem**: The Google Play Store offers a vast library of apps, covering almost every imaginable need or interest.
6. **Hardware Options**: Android devices come in various hardware configurations, allowing users to choose devices with specific features like larger screens, better cameras, or longer battery life.

Disadvantages:


1. **Fragmentation**: Due to the variety of devices and manufacturers, Android suffers from fragmentation, leading to inconsistencies in software updates and app compatibility across different devices.
2. **Security Concerns**: Android is more susceptible to malware and security threats compared to other operating systems like iOS, especially on devices with outdated software or from untrusted sources.
3. **Bloatware**: Some Android devices come pre-installed with bloatware, which can clutter the user interface and consume system resources.
4. **Privacy Issues**: Android's integration with Google services may raise privacy concerns for users who are uncomfortable with the amount of data collected by Google.
5. **Software Updates**: Software updates can be slow and inconsistent, with some devices receiving updates months after Google releases them, leaving users vulnerable to security threats and missing out on new features.
6. **User Experience Variability**: The user experience can vary significantly between different Android devices and manufacturers, leading to inconsistencies in performance and design.
Sure, I can guide you through creating a basic login program using Android Studio. Here are the steps you can follow:

Q:4.Hello world program

MainActivity.java

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

Q:5. login program


1. **Create a New Project**: Open Android Studio and create a new project. Choose "Empty Activity" as the template.

2. **Design Layout**: Design your login screen layout in XML using the Layout Editor. Typically, you'll have EditText fields for username and password, and a Button for the login action.

3. **Add Functionality**: In your MainActivity.java file, write code to handle the login functionality. This involves getting the input from the EditText fields, validating them (e.g., checking if they're not empty), and comparing them to predefined values.

4. **Toast Messages**: Implement Toast messages to display feedback to the user, such as "Login successful" or "Invalid username or password".

5. **Testing**: Test your app on an emulator or a physical device to ensure it works as expected.

Here's a simplified example of how your MainActivity.java file might look:



import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    EditText usernameEditText, passwordEditText;
    Button loginButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Initialize EditText and Button
        usernameEditText = findViewById(R.id.usernameEditText);
        passwordEditText = findViewById(R.id.passwordEditText);
        loginButton = findViewById(R.id.loginButton);

        // Set onClickListener for the login button
        loginButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // Get username and password from EditText fields
                String username = usernameEditText.getText().toString();
                String password = passwordEditText.getText().toString();

                // Validate username and password
                if (username.equals("your_username") && password.equals("your_password")) {
                    // If valid, show success message
                    Toast.makeText(MainActivity.this, "Login successful", Toast.LENGTH_SHORT).show();
                } else {
                    // If invalid, show error message
                    Toast.makeText(MainActivity.this, "Invalid username or password", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}

This is just a basic example to get you started. Depending on your requirements, you might need to add more features like encryption, database integration, or authentication with a server.


Post a Comment

Previous Post Next Post