Android Training (android fundamental)


Published on

Android Training (android fundamental)

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • The following components comprise the building blocks for all your Android applications:
  • Android Training (android fundamental)

    1. 1. Android 1 Android Training By Khaled Anaqwa
    2. 2. WHAT MAKES AN ANDROID APPLICATION?  Activities  Service  Content Providers  Intents  Broadcast Receivers  Widgets  Notifications
    3. 3. Activities      An activity represent a single screen with a user interface Most applications contain multiple activities When a new activity starts, it is pushed onto back stack User interface can built with xml or java(xml is recommended) Monitor lifespan through callback methods like onStart() , onPause() ,etc
    4. 4. Service      Services perform long-running operations in the background Dose not contain a user interface Useful for things like network operations, playing music , etc. Run independently of the component that created it. Can be bound to by other application components, if allowed (when all of them unbind, the service is destroyed)
    5. 5. Content Providers       Used to store and retrieve data and make it accessible to all applications(the only way to share data across apps) They encapsulate the data, and provide mechanisms for defining data security connects data in one process with code running in another process. Exposes a public URI that uniquely identifies data set Data is exposed as a simple table on DB model Android contains many providers for things like contacts, media ,etc
    6. 6. Broadcast Receivers  Is a component that responds to systemwide broadcast announcements  Example :announcing that the screen has turned off , the battery is low, etc.  App can also initiate their own broadcasts  Contain no user interface  They can create status bar notifications
    7. 7. APPLICATION’S PRIORITY AND ITS PROCESS’ STATES  All Android applications continue running and in memory until the system needs resources for other applications.
    8. 8. 1. Active processes  Active (foreground) processes have application components the user is interacting with.     Activities in an active state Broadcast Receivers executing onReceive Services executing onStart, onCreate Running Services that have been flagged to run in the foreground
    9. 9. 2. Visible processes  Visible but inactive processes are those hosting “visible” Activities. This happens when an Activity is only partially obscured (by a non-full-screen or transparent Activity).
    10. 10. 3. Started Service processes  Processes hosting Services that have been started. Because these Services don’t interact directly with the user, they receive a slightly lower priority than visible Activities or foreground Services.
    11. 11. 4. Background processes  Processes hosting Activities that aren’t visible and that don’t have any running Services. There will generally be a large number of background processes that Android will kill using a last-seen-first-killed pattern in order to obtain resources for foreground processes.
    12. 12. 5. Empty processes  To improve overall system performance, Android will often retain an application in memory after it has reached the end of its lifetime. Android maintains this cache to improve the start-up time of applications when they’re relaunched. These processes are routinely killed, as required.
    13. 13. Manifest XML        It names the Java package for the application(unique identifier for the app.) It describes the components of the application It determines which processes will host application components. It declares which permissions the application must have permissions that others are required to have in order to interact with the application's components. It declares the minimum level of the Android API that the application requires. It lists the libraries that the application must be linked against.
    14. 14. How Android features are reflected in the manifest file?  Intent Filters  Icons and Labels  Permissions  Libraries
    15. 15. Intent Filters  The core components of an application (its activities, services, and broadcast receivers) are activated by intents.  An intent is a bundle of information (an Intent object) describing a desired action including the data to be acted upon, the category of component that should perform the action, and other pertinent instructions.
    16. 16. By Actions
    17. 17. By Category
    18. 18. Permission   A permission is a restriction limiting access to a part of the code or to data on the device. The limitation is imposed to protect critical data and code that could be misused to distort or damage the user experience. here are some permissions defined by Android:     android.permission.CALL_EMERGENCY_NUMBERS android.permission.READ_OWNER_DATA android.permission.SET_WALLPAPER android.permission.DEVICE_POWER
    19. 19. Type of Permissions  <uses-permission>  <permission>  <permission-tree>(element declares a namespace for a group of permissions)  <permission-group>(defines a label for a set of permissions)  (tree-group)It affects only how the permissions are grouped when presented to the user.
    20. 20. Libraries  <uses-library android:name="string" android:required=["true" | "false"] />  Specifies a shared library that the application must be linked against. This element tells the system to include the library's code in the class loader for the package.  Google Play uses the <uses-library> elements declared in your app manifest to filter your app from devices that do not meet it's library requirements.
    21. 21.  All of the android packages such as  (application components)  android.content(Content sharing, Resource,Package management)  android.view (basic user interface classes that handle screen layout and interaction with the user.)  android.widget (mostly visual UI elements) are in the default library that all applications are automatically linked against.  some packages (such as maps) are in separate libraries that are not automatically linked.