reading-notes


Project maintained by sanaa-almoghraby Hosted on GitHub Pages — Theme by mattgraham

Android fundamentals

Android apps can be written using Kotlin, Java, and C++ languages. The Android SDK tools compile your code along with any data and resource files into an APK or an Android App Bundle.

Each Android app lives in its own security sandbox, protected by the following Android security features:

App components

App components are the essential building blocks of an Android app. Each component is an entry point through which the system or a user can enter your app. Some components depend on others.

There are four different types of app components:

An activity is the entry point for interacting with the user. It represents a single screen with a user interface. You implement an activity as a subclass of the Activity class.

A broadcast receiver is a component that enables the system to deliver events to the app outside of a regular user flow, allowing the app to respond to system-wide broadcast announcements.

A content provider manages a shared set of app data that you can store in the file system, in a SQLite database, on the web, or on any other persistent storage location that your app can access.

The manifest file

Before the Android system can start an app component, the system must know that the component exists by reading the app’s manifest file, AndroidManifest.xml. Your app must declare all its components in this file, which must be at the root of the app project directory.

Declaring components

You must declare all app components using the following elements:

<?xml version=”1.0” encoding=”utf-8”?> <manifest … > <application android:icon=”@drawable/app_icon.png” … > <activity android:name=”com.example.project.ExampleActivity” android:label=”@string/example_label” … > </activity> … </application> </manifest>

Declaring component capabilities

you can use an Intent to start activities, services, and broadcast receivers. You can use an Intent by explicitly naming the target component (using the component class name) in the intent