Android Application Components Activities, Services, Broadcast Recievers, Content Providers - ABNHive
Application components are the essential building blocks of Android app development. Each component is an entry point through which the system or a user can enter your app.
There are 4 types of components in android
There are 4 types of components in android
- Activities
- Services
- Broadcast receivers
- Content providers
Let's dive into the deep.
Activities
This is a component that represents a single screen with a user interface or simply an entry point for interacting with the user. Example, an email app might have one activity that shows a list of new emails.
Activities work together to form a cohesive user experience in the app.
For example, clicking a button on the first screen might replace that screen with another screen containing other widgets, a web page, a movie, or text information. Activities are typically created by subclassing (extending) the Android class Activity.
click here to know more about Activity.
Services
This runs in the background to perform work for remote processes or long-running operations. It does not provide the user interface (for instance it might play music in the background while the user is in a different app). Example, a service might play music in the background while the user is in a different app.
click here to know more about Services.
Broadcast receivers
It responds to system-wide broadcast announcements. Most of the broadcast receivers originate from the system, and although they do not display a user interface, they can create a status bar notification that alerts the user when a broadcast event occurs. Generally, it is a gateway to the other components and it only does minimal work. It used to display a persistent icon in the status bar of the device, vibrate, play a sound, flashlights, etc. to indicate to the user that something significant has happened in the background.
click here to know more about Broadcast receivers.
Content providers
This is the component that manages a shared set of app data. Through this component, the data that you store either in the file system, on the web, an SQLite database can be queried or even modified. This component is also useful for writing and reading data that is not shared and is private to your app. Android supplies by default a number of content providers for common data types like audio, video, images, or personal contact information.
click here to know more about Content providers.
- Aswin Bhim Nath
Comments
Post a Comment