Android Note: Androidmanifest.xml properties in detail (i) of the Shareduserid

Source: Internet
Author: User

First, Shareduserid

Android:shareduserid= "Com.rongqin"


Features of the UserID:

1. Identity as an APK identity

2. UserID corresponds to a Linux user, so accessing data between different apk (users) is forbidden by default.

How does the data exchange between the different apk through UserID?

In the Android system, the APK can read data between each other condition is: the same signature, and the Androidmanifest.xml file is configured in the same Android:shareduserid attribute value, then two apk run in the same process, can access any data from each other.


Ways to access other APK resources through UserID:

1. the same Shareduserid is configured in the Androidmanifest.xml of the application and plug-in (such as skin) programs:

<?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "http://schemas.android.com/apk/res/ Android "package=" Com.lonshine.skin "android:versioncode=" 1 "android:versionname=" 1.0 "android:shareduserid=" C Om.rongqin ">


2. access the resources in the APK:

Context context = Createpackagecontext ("Com.lonshine.skin", context.context_ignore_security);

Gets the context that corresponds to the Com.lonshine.skin, and can access any resource in the Com.lonshine.skin by returning the context object.


For example, apply the APK to get the bg.png in the plugin apk:

drawable drawable = Context.getresources (). getdrawable (r.drawable.bg);

This gives a reference to the image, and other XML resource files are obtained in a similar manner.


This article from the "Sky no traces but I flew" blog, please be sure to keep this source http://glblong.blog.51cto.com/3058613/1561239

Android Note: Androidmanifest.xml properties in detail (i) of the Shareduserid

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.