Android: process = & quot;: remote & quot; attribute description, androidremote

Source: Internet
Author: User

Android: process = ": remote" attribute explanation, androidremote

When learning the Android Service component, I encountered a problem, that is, the Android Application declaration file Manifest. in xml, sometimes an android: process = ": remote" is set for the service tag. What is the role of this attribute? I will share my knowledge with you.

        In the help document of Android, we can understand that the next service generally does not have its own independent process and runs as a thread in the process of its application. However, there are exceptions. The Android: process attribute in the android declaration file can specify a process for any component, including the application. In other words, you can set the android: process attribute in the Declaration file, we can create components (such as Activity and Service) and applications and run them in the process we specified. The following are the relevant documents and the author's translation.


         If we want a service to run in a remote process (instead of the standard apk process), we can use android in the tag of this service in the Declaration file: the process attribute specifies a process for it.

         Note: The "remote" name is random and subjective. You can use another name to run the service in another process. Colon ':' This prefix will append this name to the name of the standard process running in your package as the new process name.

For example, the package name of an application is com. aoyousatuo. in this example, the name of the new process that the service runs is com. aoyousatuo. example: remote. (Note: If this attribute is not specified for the component or application in the Declaration file, the application and its component will run in the process named after its package name by default ).


Android: process

     The name of the process where the service is located. Generally, all components of an application run in the default process created by the system for this application. The default process is named by the package name of the application.

       The process attribute of a tag can be set to a default value different from that of all components. However, these components can override this default value by setting their own process values, so that your applications can run across multiple processes.

        If the set process name starts with a colon, the new process is private to the application. When it is needed or the service needs to run in the new process, this new process will be created. If the name of a process starts with a lowercase character, the service runs in a global process named after the name, provided that it has the relevant permissions. This allows various components in different applications to share a process to reduce resource usage.

       For example, if an application runs in the process com. aoyousatuo. example and the android: process attribute is set to com. rabbit. man, the new process name is com. rabbit. run.

Related Article

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.