Android Development Training Session # 1 + Session # 2: Created By: Muhammad Tayyab
Android Development Training Session # 1 + Session # 2: Created By: Muhammad Tayyab
Android Development Training Session # 1 + Session # 2: Created By: Muhammad Tayyab
Application framework Dalvik virtual machine Integrated browser Optimized graphics SQLite Media support (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF) GSM Telephony (hardware dependent) Bluetooth, EDGE, 3G, and WiFi (hardware dependent) Camera, GPS, compass, and accelerometer (hardware dependent) Rich development environment
Android Architecture
Getting Started
Setting up Android Development Environment Using Android Emulator Creating first Hello World Application
Components
Application Fundamentals
Application Components
Activities
Services Broadcast
Procedure Calls
Activities
An activity presents a visual user interface for one focused endeavor the user can undertake. Activity is implemented as a subclass of the Activity base class. The visual content of the window is provided by a hierarchy of views.
objects
Services
A Service does not have a visual interface and runs in the background. Each service extends the Service base class. It's possible to connect to an ongoing service and communicate it through the interface exposed by that service. Services run in the main thread of the application process.
Broadcast Receivers
A broadcast receiver receive and react to broadcast announcements. All receivers extend the BroadcastReceiver base class. Many broadcasts originate in system code. Broadcast receivers do not display a user interface but they can start an activity or alert user.
Content Providers
A content provider makes a specific set of the application's data available to other applications. All content providers extends the ContentProvider base class. Content Providers are accessed through ContentResolver object. Content Providers and Content Resolvers enable inter-process communication (IPC)
Intents
Intents are Asynchronous messages used to convey a request or message. An intent is an object of Intent class that holds the content of the message. Activities, Services and Broadcast Receivers are activated through Intents. Intent can contain
An activity presents a visual user interface for one focused endeavor the user can undertake. Task is what the user experiences as an application. Task is a group of related activities, arranged in a stack. The activity at the top of the stack is one that's currently running. All the activities in a task move together as a unit.
Android starts a Linux process for each application by default. By default, all components of the application run in main thread of applications process. You can spawn separate threads for long operations. Threads are created in code using standard Java Thread objects
Android has a lightweight mechanism for remote procedure calls (RPCs). An RPC interface can include only methods. All methods are executed synchronously. RPC Interface id declared using IDL and Java interface definition is generated by aidl tool.
Application Fundamentals 2
Component Lifecycles
Activity
Activity Lifecycle
Activity Lifetime
Entire Lifetime [onCreate() to onDestroy()] Visible Lifetime [onStart() to onStop()] Foreground Lifetime [onResume() to onPause()]
An implementation of any activity lifecycle method should always first call the superclass version
Activity Lifecycle
Service Lifecycle
Service Lifetime
Entire
The onCreate() and onDestroy() methods are called for all services. onStart() is called only for services started by startService().
Service Lifecycle
The lifetime of a broadcast receiver is only during the execution of onReceive() method. A process with an active broadcast receiver is protected from being killed.
Process Lifecycle
The Android system tries to maintain an application process for as long as possible. Android kills the old processes based on importance when memory runs low. There are five levels in the hierarchy according to importance
Foreground process Visible Process Service Process Background Process Empty Process
Each Android Application runs in its own process which is a secure sandbox. Each Android package file installed on the device is given its own unique Linux user ID. The permissions required by an application are declared statically in that application. All Android applications must be signed. Any data stored by an application will be assigned that application's user ID, and not normally accessible to other packages.
Permissions on components
ContentProvider Permissions
URI Permissions