Android's four-tier architecture is: Linux2.6 kernel layer, core library layer, application framework layer, application layer.
The framework layer provides us with a lot of APIs for developing our applications, and we build our apps by invoking special APIs to meet the needs of our business. People who write apps know that the first step in learning Android development is to learn a variety of APIs, what activity,service,notification and so on. These are provided by the framework, so I'll tell you in detail what role the framework plays in the entire Android architecture.
Framework Features
The framework can actually be simply understood as some API's storeroom, Android developers will implement some basic functions, through the interface provided to the upper call, can be repeated calls
We can say that the framework layer is really a layer of Java language implementation, and the APIs defined in this layer are written in the Java language. But because it contains the JNI method, Jni writes the interface in C/s + +, and invokes the underlying method in the core library layer based on the function table query, ultimately accessing the Linux kernel. Then there are 2 functions of the framework layer.
1. In the Java language to write some of the standardized modules packaged into a framework for application layer developers to call for the development of a special business mobile phone applications.
2. Using Java Native interface to invoke the local method of the core Lib layer, the JNI library is loaded when the Dalvik virtual machine is started, Dalvik will directly address the JNI method and then go to invoke.
The combination of 2 methods achieves the communication between Java method and operating system. Why does Android use Java to write the framework layer? Is it better to use C or C + + directly? The following explanations are given by the experts:
C + + is too low level, developers have to spend a lot of experience on C + + language research Clearly, such as the memory mechanism, if a little attention, will forget to open or release. and Java's GC automatically handles this, saving a lot of time for developers to focus on their business. As a result, the Java development language is slowly moving up from the bottom of C + +, which interacts through the JNI and core runtime layers.
In fact, these are also the reason that Java can develop so quickly, facing the advantage of object language. Do not care too much about memory, do not worry boldly to do the realization, only time to create new things.
Framework API
Activity Manager
Used to manage the application lifecycle and provide commonly used navigation fallback functionality.
Window Manager
Provides some ways to access your phone's screen. The transparency, brightness, and background of the screen.
Content Providers
Enables applications to access data from another application, such as a contact database, or to share their own data.
View System
It can be used to build applications, which include lists (Lists), grids (Grids), text boxes (texts boxes), buttons (Buttons), and even web browsers that can be embedded.
Notification Manager
Enables the application to display custom prompts in the status bar.
Package Manager
Provides access to the system's installation package. including installation, uninstall the application, query permission related information, query application related information and so on.
Telephony Manager
It mainly provides a series of methods for accessing the status and information related to mobile communication, querying the status information of telecommunication network, SIM card information and so on.
Resource Manager
Provides access to non-code resources, such as local strings, graphics, and layout files.
Location Manager
Provides a way to obtain the address location of the device. Obviously, GPS navigation is sure to be able to use location services.
Xmpp
Extensible communication and presentation protocol. Formerly known as Jabber, it provides instant messaging services. For example, push feature, Google talk.
。。。
There are many services provided by the framework layer, and they are not listed.
Summarize
Starting with the overall Android framework, the framework layer is described in detail, with a brief description of its role and function, as well as the role played in the 4-tier framework. It then lists some of the important services that it provides to the upper class. A simple, impressive understanding of the application framework begins with a detailed study of each service in the future. Thanks
Android Frame 20160721