Introduction
Android's four-tier architecture is very clear compared to everyone, the cliché is: Linux2.6 kernel layer, core library layer, application framework layer, application layer. I am going to focus on the framework of application frameworks, which is actually my own learning experience.
The framework layer provides us with a lot of APIs for developing applications that we can use to build our apps to meet our business needs by invoking special APIs. People who write apps know that the first step in learning Android is to learn all kinds of APIs, what activity,service,notification, and so on. These are provided to us by the framework, so I'm going to elaborate on exactly what role the framework plays in the entire Android architecture.
Framework Features
The framework can be simply understood as some of the API's storehouse, the Android developer will implement some basic functions, through the interface to the upper call, you can repeat the call
We can say that the framework layer is really the layer of the 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 with C/s + +, calls the underlying method in the core library layer based on the function table query, and finally accesses the Linux kernel. Then there are 2 roles for the framework layer.
1. In the Java language to write some standardized modules encapsulated into a framework for app layer developers to invoke 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, and Dalvik directly addresses the JNI method and then invokes it.
The combination of 2 approaches achieves the communication between Java methods and the operating system. Why does Android use Java to write framework layers? Isn't it better to use C or C + + directly? The experts gave the following explanations:
C + + is too low-level, developers have to spend a lot of experience in C/A + + language research Clearly, such as C + + memory mechanism, if a little attention, will forget to open or release. The Java GC will automatically handle these and save a lot of time for developers to focus on their business. That's why it's slowly moving up from the bottom of C + + to the Java development language, which interacts with the core runtime layer through JNI.
In fact, these are also the reason Java can develop so quickly, facing the advantages of object language. Do not pay attention to memory, do not worry about the bold to achieve, only time to create new things.
Framework APIs
Activity Manager
Used to manage the application lifecycle and provide common navigational fallback functionality.
Window Manager
Provides some ways to access our mobile phone screen. The transparency, brightness, and background of the screen.
Content Providers
Enables an application to access data from another application, such as a contact database, or to share their own data.
View System
Can be used to build an application that includes a list (Lists), a grid (Grids), a TextBox (text boxes), a button (Buttons), or even a Web browser that can be embedded.
Notification Manager
Allows the application to display custom hints in the status bar.
Package Manager
Provides access to the installation package for the system. including installation, uninstall applications, inquiries permission related information, inquiries application related information.
Telephony Manager
It mainly provides a series of methods for accessing the status and information related to mobile communication, querying Telecom network status information, SIM card information and so on.
Resource Manager
Provides access to non-code resources, such as local strings, graphics, and layout files (Layout files).
Location Manager
Provides a way to obtain the address location of a device. Obviously, GPS navigation can certainly use the location service.
Xmpp
Extensible communication and presentation protocols. Formerly known as Jabber, provides instant messaging services. such as push function, Google Talk.
。。。。
The framework layer provides a lot of services, and it's not listed.
Summarize
Starting with the overall Android framework, we have only described the framework layer in detail, with a brief description of its role and function, and the role it plays in the 4-tier framework. Then enumerate the important services that it provides to the upper level. The application framework has a simple impression of understanding, as a start, and later on each service in detail.
Thank you for reading, I hope to help you, thank you for your support for this site!