Android Building Blocks.
The fundamental building blocks of Android are Activities, Services, Broadcast Receivers and Content Providers. Interchange in data between these blocks is handled by Intents which can be either Explicit or Implicit intents.
There are following four main components that can be used within an Android application.
Activities
It Control the UI and handle the user interaction to the Android App screen,it represents a single screen with a user interface.Activity performs actions on the screen, For example, Medium application might have one activity that shows a list of articles while another activity to read the Notifications and another activity for viewing user profile.
Services
The Service is another building block of Android applications. They handle background running tasks associated with an application. It is a program that can run in the background for an infinite period and it does not provide a UI. A good example of service is the music player app, let us consider Google play Music which keep on playing music while the main android app activity is destroyed or closed.
Broadcast Receivers
They handle communication between core Android OS and applications running on the surface layer. The application modules communicate with each other using the broadcast receiver. Messages can be initiated by the system or the app. For example, if a user is using your app and a phone call comes in, the Broadcast Receiver interface will notify your app.
Content Providers
They handle data interchange and database related components. This provides a uniform singular interface to the content & data. The content can be from your app being exposed to the system or other apps or it could be system content for example, pictures on your phone, contact lists, or files in the file system. It provides a consistent interface to retrieve/store data via external data sources or databases.
References:
https://developer.android.com/
Find code on:
