DEV Community

Cover image for The Fundamentals of Android Development.
Daniel Brian
Daniel Brian

Posted on

The Fundamentals of Android Development.

Learning objectives

  1. Provide an overview of the difference between mobile apps and mobile websites.
  2. Explain how the mobile Operating system works.
  3. The Android Operating system.
  4. Introduction to Android development.

Mobile Platforms
A mobile app is an installable software that runs on a smartphone device. Mobile apps use the device's hardware, and software features and usually provide an efficient, more intuitive, and seamless user experience.

What is the difference between a mobile app and a mobile website?

A mobile app is software that runs on a hardware device whereas a mobile website works on a mobile app and does not involve any hardware to be functional.

What are the advantages of mobile apps and a mobile website?

Mobile app

  1. Faster than mobile websites
  2. Can access resources eg location, Bluetooth, etc.
  3. Can work without internet access

Mobile website

  1. Cheap to build and maintain
  2. Need not to be built from scratch to be compatible with other platforms
  3. No approval is required from Appstore

Note:To determine whether to develop a mobile website or mobile app always ask yourself what specific actions you expect your product to perform.

How does a Mobile OS work

The most fundamental software for any mobile device is its OS. An OS is designed to coordinate communications that occur between the hardware and apps of mobile devices. It manages the overall experiences of an app.

Mobile operating system
mobileOS
A mobile OS typically starts up when a device powers on, displaying different application icons and user interface (UI) elements to users.

Uses of Operating system

  1. Allows smartphones, tablets, and personal digital assistants (PDAs) to run applications.
  2. OS provides a channel with which applications can access device resources such as the processor, memory, Wi-Fi, Bluetooth, and more.

The most common operating systems are Android and iOS.

Android

Android

  • Android is a mobile OS that was released in 2008.
  • Android OS is based on a modified version of the Linux kernel and is an open-source software which means anyone can modify it.
  • Android OS was built primarily for smartphones, Chromebook, Android TV, and Android Auto, as well as wearables such as smartwatches.
  • Android has built-in sensors such as gyroscopes and accelerometers, which gives users a multi-touch experience.

iOS

ios

  • iOS is Apple’s proprietary OS that runs on the iPhone, iPad, and other mobile devices
  • Same as Android, iOS has built-in sensors such as gyroscopes and accelerometers, which gives users a multi-touch experience through several actions such as swiping, pulling, and tapping, and users can seamlessly interact with the screen.
  • With the rise in popularity of iOS, developers now have more controls and access to its features.

Other mobile operating systems include kaiOS which runs on Mozilla Firefox, SailfishOS from Jolla, and Huawei's HarmonyOS which was released in 2019 and runs on a microkernel that Huawei developed. Mostly used in IoT devices.

Android Platforms

  • Being the most used operating system in the world, Android is not limited to only mobile devices. Android is also used to power other devices due to its openness to others.
  • Android platforms include, Chromebook, Android TV, Android Auto, and WearOS.

Chromebook

chromebook

  • Chromebooks are portable laptops that have support for running Android apps, which gives them more features.
  • Chromebooks operate on Google's ChromeOS.
  • Ability to use convertible form factors to not necessarily build apps from scratch for phones and tablets from ChromeOS.

Android TV

androidtv

  • Android TV is designed to bring the mobile experience to your TV.
  • The voice control feature of the TV allows you to have complete control over your devices.

Android Auto

Android Auto

  • It allows you to connect your phone to your car display.
  • It automatically shows your apps on your car display and makes it possible for you to get driving directions and navigate seamlessly.
  • Android Auto is made to help you stay focused on the road.

WearOS

wearos

  • WearOS is Google's Android OS that is specifically designed to power smartwatches and other wearables.
  • The early release of WearOS allowed watching owners to install WearOS apps through their mobile phones from the google play store.

Introduction to Android Development

Android Languages

  • In the world of Android development, Java and Kotlin are both extremely popular programming languages.
  • Java, which was released by Sun Microsystems in 1995 while Kotlin was introduced by JetBrains in 2011.

kotlinvsjava
-Kotlin has officially become the preferred language for Android app development due to the following reasons;
1. It is concise and standardized hence low code errors.
2. Easier to maintain complex projects due to low code.
3. It is compatible with java hence easy to convert java
code to Kotlin.
4. Kotlin handles errors that crash Android apps better
than java.

The Android OS

  • Android is a Linux-based OS primarily designed for touchscreen mobile devices such as smartphones and tablets.
  • Some of the unique features and characteristics of the Android OS include:
  1. Near-field communication: This feature makes it easy for electronic devices to communicate over short distances.
  2. Wi-Fi: With this feature, users can connect to various wireless access points around them due to these in-built technologies that support Wi-Fi protocols.
  3. Custom home screen: Android OS allows you to further personalize your home screen the way you like it.
  4. Widgets: Used for home-screen customization to give you a glance view of users' most important data.
  5. App downloads: users can unlock the full potential of the Android operating system through app downloads.
  6. Custom ROMS: Android can use customized and modified versions of Android OS to access features of a recent on an older device.

The Android OS Architecture

  • Consists of components that Android needs to be functional.
  • Android is built on top of an open-source Linux kernel and other C and C++ libraries exposed via application framework services.
  • The Android OS is a stack of software components roughly divided into five sections:

    1. Applications
    2. Application frameworks
    3. Android runtime
    4. Platform Libraries
    5. Linux Kernel
  • These are separated into 4 layers, as shown in the architecture diagram below.

AndroidOS layers

Android App Cheatsheet

  • To get started with developing an app, you need a clear understanding of relevant concepts.
  • These concepts include:

Top-level component

  • Enables apps to connect to the internet, make calls, and take pictures through BroadcastReceiver, ContentProvider, and Service and activity accessible in Android SDK.

Activity Components

  • These are activities present for content users to interact with on the screen.
  • Single activity architecture pattern allows one activity or a relatively small number of activities to be used for an entire app.

Android views

  • This is the design interface that occupies a rectangular area on the screen and is responsible for drawing and event handling. It displays text, images, and more.

Android layout files

  • In Android, each layout is represented by an XML file. These plain text files serve as blueprints for the interface that your application presents to the user.

Project files

  • Android Project Files belong to one of three main categories: configuration,code, and resource. Configuration files define the project structure, code files provide the logic, and resource files provide essentially everything else.

Anatomy of An Android App

  • This basically looks into the components that go in when creating an App.

Anatomy

  • An Android app is made up of four major components that serve as the building blocks of any Android app in the market.
  • The four major components include:
  1. Activities: This is the entry point of users that represent a single user. It allows you to place UI components, widgets, or user interfaces on a single screen. eg a music player app may have an activity that shows you a list of your favorite songs, another activity that allows you to play a specific song, and another which shows you a list of trending songs.
  2. Services: They run in the background and constantly update the data sources and activities with the latest changes. It also performs tasks when users are not active on applications. eg A good example of a service is chatting with someone whilst listening to music.
  3. Broadcast Receiver: Its purpose is to respond to messages from other applications or systems in real time. eg,imagine you're enjoying your favorite song on your music app when you get a notification that you're running low on battery power.
  4. Content providers: It's responsible for sharing data between applications. eg A typical example is a social media app that allows users to share their images online.

These Android components are coupled by a configuration file called AndroidManifest.xml. It is used to specify each component and how they interact with each other.

Androidmanifest

Extensible Markup Language(XML)

  • XML (Extensible Markup Language) is used in the presentation of different kinds of data. Its main function is to create data formats that are used to encode information for documentation, records, transactions, and several other data formats. xml
  • For an XML document to be valid, the following conditions must be fulfilled:
  1. The document must be well-formed.
  2. The document must comply with all the rules of the XML syntax.

THE END.

Thank you for taking the time to go through the article!!

TheEnd

Top comments (0)