Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of apk format in Android

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of the use of apk format in Android, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value, I believe you will have something to gain after reading this Android apk format. Let's take a look at it.

The construction of Android apk is really wonderful, it absorbs the idea of client/service, apk does not have its own independent entry function, but only contains one or more component, and determines which component is needed according to the manifest configuration file when the program is executed.

The activation of conponent is triggered by intent. To put it bluntly, intent is an action that includes operation and operation data, which means that the component is a service provider. Intent brings the request, and then it executes the request. And intent can specify component to execute the request, or it can not specify that component selects the most appropriate component to complete the request based on the matching of the filter.

And another is that the process in the application layer is distinguished by linux user ID, each process corresponds to a virtual machine, but multiple applications can be run in a process, not just one. In fact, this is also easy to understand, an application is multiple component, multiple applications can be regarded as an apk composed of many component.

1 、 activity

In Android apk, activity is a UI concept, and an application can have multiple Activity. In fact, an Activity is a window, and the contents are all kinds of view. Associate the window with the content through setContentView ().

2 、 service

Service can actually be seen as a component running in the background without UI. In Android, this service can be divided into two types. One is that the required service is running in a local process, that is, running in the same process as the application, and the other is that the service is running in other processes.

3 、 Broadcast receivers

This is actually an intent receiver. When the system broadcasts intent, it receives events of interest to the application, and broadcast receivers does not have a UI interface. Apk can include this component directly or you can register one at run time.

4 、 Android apk

This translates to provide a common interface for applications to share their own data, and other applications can access the data according to these common interfaces. It provides an adapter content resolver through which applications manipulate content provider. When the application starts execution, it first reads the manifest, then initializes some component based on the xml configuration file, and then it stops waiting for the intent to arrive.

So several concepts that are very important in an application are: component, manifest.xml,intent, intent-filter. The more important ones in component are activity and service. Let's take a look at the life cycle of a process: after a process is opened, the operating system will try to keep it running, and when it is found that there is insufficient memory, the system will force the kill process according to the following priorities:

1. Empty process first considers the processes that are shut down without any activated component. The main reason to retain such processes is to make restart faster, so when memory is insufficient, such processes are first considered to be dropped by kill.

2 、 background process

The second consideration is that the thread that owns the activiry but the activity is invisible is shut down.

3 、 visible process

The third consideration is that the activity of the process is visible, but not the one where forground is interacting with the user.

4 、 forground

* the process in which activiry is at the forefront is considered. There is another problem here, that is, if a process is bound to a service, it has a higher priority than a process running in the background, which means it is less likely to be kill.

Google gives up "don't do evil"? Intend to monopolize Android

Illustrating the principle of Android application construction

Analysis on the performance of Android DDMS

Explore the working principle of Android DDMS

Operating skills of Android source code

So binding a service when designing an application is much safer than opening a thread in the process to run long tasks. In manifest.xml, each component has a process option to specify that the process it is running allows an application's Android apkt to run in a process.

You can also have the component of multiple applications run in a single process to share data. A special language IDL is provided in java to automatically generate the source code for remote process calls, and the application only needs to implement some of its interfaces, which facilitates RPC programming.

This is the end of the article on "what is the use of apk format in Android?" Thank you for reading! I believe you all have a certain understanding of the knowledge of "what is the use of apk format in Android". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report