Posted on December 22, 2021 at 08:34 AM
What is Android Jetpack?
Android Jetpack is a collection of libraries, tools which help us in building great Android apps. Architecture, UI, Behavior, and Foundation are four categories for using Jetpack.
Architecture Components could be classified as follows: Room, WorkManager, Lifecycle, Navigation, Paging, Data Binding, ViewModel, and LiveData.
These software components (libraries, tools) helps in:
- Following the best practices and writing the boilerplate code.
- Making complex things very simple.
All the major problems that have been solved by the Android Jetpack’s software components are:
- Managing activity lifecycles.
- Surviving configuration changes.
- Preventing memory leaks.
Android Jetpack Components
Android Jetpack components are a collection of libraries, tools that are individually adoptable and built to work together while taking advantage of Kotlin language features that make us more productive.
These are the four components:
- Foundation Components
- Architecture Components
- Behavior Components
- UI Components
Foundation components provide backward compatibility, testing and Kotlin language support.
Foundation components are as follows:
- App Compat: Degrade gracefully on older versions of Android with material design user interface implementation support.
- Android KTX: Set of Kotlin extensions to write more concise, idiomatic Kotlin code.
- Multidex: Provide support for multiple dex files for apps.
- Test: A testing framework for unit and runtime UI tests in Android.
The architecture components help us in building robust Apps, testable Apps, maintainable Apps
Architecture components are as follows:
- Data Binding: Declaratively bind UI elements in our layout to data sources of our app.
- Lifecycles: Manages activity and fragment life cycles of our app.
- LiveData: Notify views of any database changes.
- Navigation: Handle everything needed for in-app navigation.
- Paging: Gradually load information on demand from your data source.
- Room: Fluent SQLite database access.
- ViewModel: Manage UI-related data in a lifecycle conscious way.
- WorkManager: Manage all background jobs in Android with the circumstances we choose.
The behavior components help in the integration with standard Android services like notifications, permissions, sharing, assistant
Behavior components are as follows:
- Download Manager: Schedule and manage large downloads in the background with auto-retry support.
- Media & playback: Backwards compatible APIs for media playback and routing (including Google Cast).
- Notifications: Provides a backward-compatible notification API with Wear and Auto support.
- Permissions: Compatibility APIs for checking and requesting permissions in-app.
- Preferences: Create interactive settings screens for users to configure.
- Sharing: Provides a share action suitable for an app’s action bar.
- Slices: Create flexible UI elements that can display app data outside the app and can be extended all the way back to Android 4.4.
The UI components provide widgets and helpers to make your app not only easy but delightful to use.
UI components are as follows:
- Animation and transitions: Move widgets and transition between screens.
- Auto: Components to develop Android Auto apps.
- Emoji: Enable updated emoji font on older platforms.
- Fragment: A basic unit of composable UI.
- Layout: Layout widgets with different algorithms.
- Palette: Pull useful information from color palettes.
- TV: Components to develop Android TV apps.
- Wear: Components to develop Wear apps.