android:process= ": Remote" property commentary

Source: Internet
Author: User

The problem with learning about Android service components is that sometimes a android:process= ": Remote" is set for the relevant service tag in the claim file manifest.xml of the Android app. How does this attribute work? The following author will organize their knowledge and share with you.

In the Android Help document we can see that in general, a service does not have its own independent process, which is typically run as a thread in the process of the application in which it resides. However, there are exceptions, and the Android:process attribute in the Android claims file can be used for any component including application-specific processes, in other words, by setting the Android:process property in the declaration file, we can let the component (for example, activity, Service, etc.) and applications (application) are created and run in the processes we specify. The following is the relevant information and the author's translation.

If we need to have a service run in a remote process (rather than running in the normal process of its apk), we can specify a process for it through the Android:process property in the tag of the service in the declaration file.

Note: The name "remote" Here is arbitrarily subjective, and you can use other names to make the service run in a different process . The colon ': ' prefix will append this name to the name of the standard process that your package is running as the new process name.

For example, if the package name for an app is com.aoyousatuo.example, the name of the new process that the service will run in this example is com.aoyousatuo.example:remote. (Note that if the component or application in the declaration file does not specify this property, the default app and its components will run accordingly in the process named after their package name).

Android:process

The name of the process where the service is located. Typically, all components of an app run in the default process that the system creates for the app. This default process is named after the application's package name.

The process property of a label can be set to a default value that differs from all components. However, these components can override this default value by setting their own process value, which allows your app to run across multiple processes.

If the process name that is set begins with a colon, the new process is private to the application, and the new process is created when it is needed or the service needs to run in a new process. If the name of the process starts with a lowercase character, the service will run in a global process named after that name, assuming that it has the appropriate permissions. This allows various components in different applications to share a single process, thereby reducing the resource footprint.

For example, when an app runs in process Com.aoyousatuo.example and the Android:process property is set to Com.rabbit.man, the new process name is Com.rabbit.run.

android:process= ": Remote" property commentary

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.