zoukankan      html  css  js  c++  java
  • APP Fundmentals

    http://developer.android.com/guide/components/fundamentals.html

    1. APP Fundmentals

        (1) Android is a multi-user Linux system in which each application is a different user.

        (2) By default, the system sets each application  a unique Linux user ID (used only by the system, unknown to theapplication) 

                                              sets permissions for all the files in an application so that only the user ID assigned to that application can

                                              access  them.

        (3) each process has its own virtual machine (VM), so an application's code runs in isolation from other applications.

        (4) By default, every application runs in its own Linux process. Android starts the process when any of the application's components

             need to be executed, then shuts down the process when it's no longer be needed or when the system must recover memory for other

            applications.

            In this ways, the Android System implements the principle of least privilege --- By default, each application has access only to the

            components that it requires to do its work and no more.

        Ways for an application to share data with other applications and to access system device.

        (1)  arrange two applications to share the same Linux user ID.

              they can also arrange to run in the same Linux process and share the same VM.   

        (2)  an application can request permission to access device data such as contacts, but the permissons must be granted to by the user at install

              time.

    2.  APP Components

         each component is a different entry point through which the systme can enter your application.

       

        (1) Activity: represents a single screen with a user interface.

        (2) Service: runs in the background to perform long-running operations or to perform work for remote processes

        (3) Content provider: manages a shared set of application data. You can store the data in the file system, a SQLite database, on the web, or any 

             other persistent storage location your application can access.

        (4) Broadcast receiver: responds to system-wide broadcast annoucements.

                  Althougn the don't display a user interface, they may create a status bar notification to alert the user when a broadcast event occurs.

                  Each broadcast is delivered as an Intent Object.

    3. Activating Component

        Intent - activities, services, and broadcast receivers are activated by an asynchronous message called an intent (messengers

        request an action for other components).

        For activities and services, an intent defines the action to perform.

             Activities, passing an intent to startActivity() or startAcitvityForResult().

             Services, passing an intent to startService() or bindService.

        For Broadcast Receivers,  the intent simply defines the announcement being broadcast.

             Broadcast Receivers, passing an intent to methods sendBroadcast(), sendOrderedBroadcast(), sendStickyBroadcast().

        For Content Provider,  it is activated when targeted by a request from a Content Resolver.

    4. The Manifest File

        Before the system can start an application component, the system must know that the component exists by reading the

        application's AndroidManifest.xml. Your application must declare all its components in this file, which must be at the root of the

        application project directory.

            Aditional things

            (1) Identify any user permissions the application requires.

            (2) Declare the minimum API Level.

            (3) Declare hardware and software features used or required by the application.

            (4) API libraries the application needs to be linked against (other than the framework APIs), such as the Google Maps libraries.

                 And more.

    5.  Declaring Components

        <activity>

        <service>

        <receiver>

        <provider>

        Activities, Services,  Content Providers, do not declare in the Manifest file are not visible to the system, and can never run.

        Broadcast Receivers can either declared in the Manifest or created dynamically in code, and registered with the system by calling

        regiterReceiver().

       

    6. Declaring component capabilities

        If there were multiple components that can perform the action described by the intent, then the user selects which one to use.

        The way the system identifies the component that can respond to an intent is by comparing the intent received to the intent filters provided in

        the Manifest file of other applications on the device.

      

        Intent filters declare the capabilities of the component so it can respond to intents from other applications.

    7. Declaring application requirements

        Important device characteristics  that you should consider as you design and develp your application

        (1) Screen size and destiny.

        (2) Input configurations.

        (3) Device features.

        (4) Platform Version

    8. Application Resources

        For every resource that you include in your Android the SDK build tools define a unique integer ID (different from user ID), which you can

        use to reference the resource from your application code or from other resources defined in XML file.

        For example,  if your application contains an image file named logo.png (saved in the res/drawable/directory), then the SDK tools generate 

        a resource ID named R.drawable.logo, which you can use to reference the image and insert it in your user interface.

       

      

  • 相关阅读:
    HDU1058Humble Numbers
    HDU1056 HangOver
    HDU1048The Hardest Problem Ever
    HDU 1028Ignatius and the Princess III(母函数简单题)
    HDU1014Uniform Generator
    HDU1013Digital Roots
    HDU1005Number Sequence(找规律)
    HDU1004 Let the Balloon Rise(map的简单用法)
    HDU1002 -A + B Problem II(大数a+b)
    Codeforces Round #363 (Div. 2)->C. Vacations
  • 原文地址:https://www.cnblogs.com/gavinwu/p/3103255.html
Copyright © 2011-2022 走看看