Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is sharedUserId in Android, and how is it used?

I am confused in sharedUserID.what is use of sharedUserId?How to use?Where to use in android?

like image 751
Bhargav Panchal Avatar asked Mar 20 '12 08:03

Bhargav Panchal


People also ask

What is manifest file in Android with example?

Every app project must have an AndroidManifest. xml file (with precisely that name) at the root of the project source set. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

What is used by the Android system to uniquely identify your app?

By default, Android assigns each app its own unique user ID. However, if this attribute is set to the same value for two or more apps, they will all share the same ID — provided that their certificate sets are identical. Apps with the same user ID can access each other's data and, if desired, run in the same process.

What is Android UID system?

Android assigns a unique user ID (UID) to each Android application and runs it in its own process. Android uses this UID to set up a kernel-level Application Sandbox.

What is the root element of AndroidManifest XML?

manifest is the root element of the AndroidManifest. xml file. It has package attribute that describes the package name of the activity class.


2 Answers

By default, Android assigns a user id to an application. It is the unique id for your application and means that nobody except the user with this id can reach your application's resources. You cannot access the data of an other application or run it in your current process. when, from an activity, an activity of another application is called android passes the control to the new activity called and they run in totally different processes.

However, in your manifest file, you can explicitly identify a user id for your application. When you declare the same user id for more than one application, they can reach each other's resources (data fields, views, etc.). You can display data from another application or run it in your process.

this is how you use it: from http://developer.android.com/guide/topics/manifest/manifest-element.html

    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="string"     android:sharedUserId="string"     android:sharedUserLabel="string resource"      android:versionCode="integer"     android:versionName="string"     android:installLocation=["auto" | "internalOnly" | "preferExternal"] >     . . .</manifest> 
like image 144
cagla Avatar answered Oct 04 '22 21:10

cagla


SharedUserId is used to share the data,processes etc between two or more applications. It is defined in AndroidManifest.xml like,

<manifest     xmlns:android="http://schemas.android.com/apk/res/android"     android:sharedUserId="android.uid.shared"     android:sharedUserLabel="@string/sharedUserLabel"     ...> 

and define the shared parameter in Android.mk for that app, like

LOCAL_CERTIFICATE := shared 

Hope its helpful to you.

like image 39
Parthraj Avatar answered Oct 04 '22 22:10

Parthraj