For each app component like activity
and service
a corresponding XML element must be declared in the manifest file
An entry point for interacting with the user. It represents a single screen with a user interface
An email app can have two different activities: one to read emails, and the other to write an email. The two activities work together to form a cohesive user experience, but each one is independent of the others. Therefore, each activity must be declared separately. You can also add an ativity to access a camera in order to attach a picture or a video.
What to consider when making an activity
A general-purpose entry point for keeping an app running in the background
Since a service
tag is used to run an Android app in the background, a service
tag does not provide a user inteface. For example, a service
tag may play some music in the background while the user is in a different app. Another component like an activity
can start the service
and let it run or bind to it in order to interact with it.
Two semantics services tell can tell tye system about how to manage an app:
Activities
and services
are activated by an asynchronous message called an intent
, which binds individual components to each other at runtime. Intent
defines the action to perform and may specify the URI of the data to act on. An intent
may convey a request for an activity
to show an image or to open a webpage. You can also start an activity
to receive a result in which case the activity
also returns the reuslt in an intent
If a component
is declared in AndroidManifest.xml
without a specific package name but uses a .
instead, it assumes that the app’s package name must be used. An Intent
object is defined with <intent-filter>
element in AndroidManifext.xml