Understanding Android Application Development: Components, SDK, and Linux-based OS
Table of contents
Open Source - Linux Based - Operating System
Applications are built for this operating system using different programming Languages.
β How does it Work
Android SDK (Software Development Kit) Tools compile our code along with any data and resource files into an APK or an Android App Bundle.
Android SDK is a collection of libraries and Software Development tools that are essential for Developing Android Applications. Whenever Google releases a new version or update of Android Software, a corresponding SDK also releases with it. These tools provide a smooth flow of the development process from developing and debugging. Android SDK is compatible with all operating systems such as Windows, Linux, macOS, etc.
Android Application Package Kit (.apk)
is a packaging file format (archive file) used by Android OS for the distribution and installation of applications which includes application content required at runtime like application code in (.dex)
format, manifest file, resource files, etc.
Android App Bundle (.aab)
is a publishing format (archive file) used by Google Play to generate and serve optimised .apk
's to each user's device. It includes the Android Application and additional metadata that is not required at runtime. Therefore, users can get smaller and more optimised downloads.
π Role of Linux?
Every Android app operates within its own secure environment, isolated by key Android security features. The Android OS functions as a multi-user Linux system, treating each app as a distinct user. Each app is assigned a unique Linux user ID by default, known only to the system and not the app itself. Furthermore, each app's code runs in a separate virtual machine (VM), ensuring isolation from other apps.
By default, each app runs in its dedicated Linux process. The system initiates the process when any of the app's components need execution and terminates it when no longer necessary or to reclaim memory for other apps.
Despite this segregation, there are mechanisms for apps to share data or access system services:
Apps can share the same Linux user ID, enabling them to access each other's files. They may even share the same Linux process and VM to conserve system resources.
Apps can request permission to access device data, such as location, camera, and Bluetooth connections.
βοΈ App Components
Component is a piece of code, App Components are an essential building block of Android App. Each Component has a distinct purpose and a distinct lifecycle that defines the start and end of that component.
π± Activity
Represents a single screen, with UI. Implemented as a class, making it the child of the
Activity
Class.β Instagram Home Page and DM Section are different activities.
πΎ Service
Background action performed by the application that does not provide a UI. Provides nonstop working of the app without breaking any interaction with the user. Implemented as a class, making it the child of the
Service
Class.β Spotify music in the background even when the app is not active.
π’ Broadcast Receiver
Lets the system deliver events to the app outside of a regular user flow so the app can respond to system-wide broadcast announcements. Both the system and other applications can initiate a broadcast. Implemented as a class, making it the child of the
BroadcastReceiver
Class.β Alarm rings even when the application is closed, Battery Low Pop-Up.
π€ Content Providers
manages a shared set of app data that you can store in the file system, in a database or any other persistent storage location that your app can access
Used for transferring the data from one application to another at the request of the other application. These are handled by the
ContentResolver
class. This class implements a set of APIs(Application Programming Interface) that enables the other applications to perform the transactions. Any Content Provider must implement the Parent Class ofContentProvider
class.β Android system provides a content provider that manages the user's contact information, which can be queried by other applications.
How are these components activated?
Intent (asynchronous message) activates activities, services and broadcast receiver. Content Providers are activated when a transaction is requested by a Content Resolver.