What is Android
Framework API: Activities
Framework API: Tasks
Framework API: Services
Framework API: Content Providers
Framework API: Broadcast Receivers
Framework API: AndroidManifest.xml
A simple example
3. What is Android
„Android is a software stack for mobile
devices that includes an operating
system, middleware and key
Based on the Linux Kernel, open source
libraries, an open source VM to abstract
the phone features (Dalvik) and the
programmable app framework
All code is Apache v2 licensed
5. Android Development
Apps are written in Java. → .apk files
Each App has their Linux user ID. →
Each process has its own VM → isolation
An App has only access to necessary
components. → Security & Sharing
6. Android Development
An App can be composed by the next
Activities : Single screen with user interface.
Ex: Mail App → Its composed by several activities
(List of mails, new message, …)
Services : A component that runs in the backgroud.
Ex: Listening music while the device is locked.
Content Providers : Manages a shared set of App
Ex: User's contact info. → ContactsContract.Data
Broadcast Receivers : Allow to share
7. Android Development
Framework API : Activities
- Resumed (running)
- Paused (another activity is visible on
top of this one)
*can be killed by System in low mem. Situation.
- Stopped (in the backgroud)
-Entire Lifetime OnCreate() to OnDestroy()
-Visible Lifetime OnStart() to OnStop()
-Foregroud Lifetime OnResume() to OnPause()
8. Android Development
Framework API : Tasks
When an activity is launched, the previous ones are
saved to BackStack.
An activity can start activities that exist in other Apps.
→ A task is a collection of activities that users can
9. Android Development
Framework API : Services
A Service is an App component running in the background and
doesn't provide a user interface.
A service can take two forms:
- Started [startService()]: Indepently of
father App (can run indefinitely).
Usually a single operation. (Upload file)
- Bound [bindService()]: Depends of
Usually offers Client-server interface.
A service can work both ways with:
onStartComand() & onBind()
10. Android Development
Framework API: Contents Providers
A Content Provider is an App component that
stores and retrieves data and makes it accessible
to all App.
The data can be stored using Android's file
storage or SQLite databases.
Each Content Provider exposes a public URI.
If you want to make own data public, you can:
1. Create your own content provider.
2. Add the data to an existing provider.
11. Android Development
Framework API: Broadcast Receivers
Most common: Notifications to user. It can be:
1. Toast Notifications → SMS that pops up on screen.
Context context = getApplicationContext();
CharSequence text = "Hello toast!";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text,
2. Status Bar Notifications → Adds an icon to
the system's status bar with optional SMS.
3. Dialog Notification
12. Android Development
Framework API: AndroidManifest.xml File
Every App must have this file in its root directory.
The file contains components description of App.
These declarations let the Android system know:
Components that can be used (GPS,...)
Under what conditions they can be launched
Permissions of the App. (interact with others)
Libraries of API (Google Maps)
<application android:label="Snake on a Phone">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
14. Android development
After downloading the SDK tools, we also
need the toolchain for debugging and
loading code to targets, and the specific
API for each Android release
On linux (after extracting the SDK)
Install Platform-tools, SDK platform for
the desired Android version, code
samples and documentation
15. Android development
Eclipse has a plugin specifically designed
for Android development
Repo a https://dl-ssl.google.com/android/eclipse/
Since Android itself is open source, an
NDK also exists for native development
Development at the VM-level, outside
the Java API, using C and C++
16. A simple example
1) Create a new virtual device target,
running some Android version
2) Create a new test project in Eclipse
from one of the SDK samples
3) Run it!
It will automatically be loaded on the
Virtual Device or on the plugged in
Device must run the Android version the
sample code is developed for!