Android-based application components

Source: Internet
Author: User

Android applications are composed of several different types of components, each of which has a specific security design approach that directly affects the security of the application. The main types of Android application components are: active (activity), services (service), broadcast receivers (broadcast receiver), content providers (contents Provider), Intentions (Intent), Widgets, Notifications (Notification), etc. The most important of these is the first 5 species. When deciding which of these components to use to build an Android application, they should be listed in the Androidmanifest.xml file, which declares the application components and their characteristics and requirements. The following is a description of the activities (activity), services (service), content providers (contents Provider), broadcast receivers (broadcast receiver), and intent (Intent) 5 components.

Activities (activity)

Activity is the presentation layer of the application, showing the user interface, an activity is usually presented as a visual user interface, such as a phone's contact feature may contain a contact list of activity, an activity to edit the contact information, And some other activity to view or modify information. Each activity is relatively independent, and these activities work together to form a contact application. An application can contain one or more activity, which typically starts after each application is run to show the first interface, initiating a new activity in the activity currently displayed to the user, or invoking the acitivity of another application, The implementation jumps from one interface to another.

Services (Service)

The service runs in the background and does not show the user interface. They can provide data source updates for the activity in the foreground and trigger notifications. For example, users can start a service to play background music when they are dealing with something else, or start a service on the mail client to download new messages intermittently by connecting to the mail server.

Another important use of the service is to achieve interprocess communication through Aidl (Android Interface Definition language,android Interface Description Language). For example, in an application, other application components can interact directly with the service that is running in the background of the application, and on the other hand, multiple applications through the service can implement communication between them in the context of ensuring that the process is secure.

Content provider (contents Provider)

Content provider is an application-to-data sharing mechanism that provides a way for multiple applications to share stored data, which is equivalent to a cross-application data operation, an application that allows other applications to pass content provider to its SQL data, images, Sound or other data types are added, deleted, changed, checked and other operations. Content provider provides a unified interface for data manipulation, providing 4 interface functions for Applications: Intsert,update,delete and Query,content provider block the implementation details of data manipulation, The application only needs to invoke the corresponding interface function via content provider, which greatly simplifies data manipulation across applications.



Android-based application components

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.