Every Android app will consist of components, a manifest file, and resources.

Components consist of four pieces:

Activities

  • A single screen with a user interface (aka view)
  • Most applications contain multiple activities
  • When a new activity starts, it is pushed onto the back stack (Stack of Activities)
  • User interface can be built with XML or in Java (Nice separation of UI code + Java logic)
  • You can monitor lifespan of an activity through callback methods: onStart(), onPause(), etc.

Services

  • They're what you use to perform long-running operations in the background
  • Does not contain a user interface. THey're useful for network operations, background music
  • Services run independently of the component that created it
  • They can be bound to by other application components --if you allow them to.

Content Providers

  • Used to store and retrieve data and make it accessible to all applications.
  • This is the only way to share data across applications.
  • It exposes a public URI that uniquely identifies its data set.
  • Data is presented as simple as a simple table on a database model
  • Android contains many content providers like contacts, e-mails, media

Broadcast receivers

  • It responds to system-wide broadcast announcements
  • Example, when the screen turns off, the battery is low, someone has taken a photo.
  • Applications can initiate their broadcasts that others can listen to.
  • Broadcast receivers contain no user interface.
  • They can create status bar notifications to alert the user. "Notifications"

Android-Manifest.xml

  • The purpose of this file is to give the Android system information about your application
  • It describes the components in your applications
  • It declares the permissions required to run the application
  • Declares the minimum Android API level that the use requires