Two Android applications with the same user ID

后端 未结 1 1502
孤独总比滥情好
孤独总比滥情好 2020-12-06 01:07

From http://developer.android.com/guide/topics/fundamentals.html:

It\'s possible to arrange for two applications to share the same Linux user ID, i

相关标签:
1条回答
  • 2020-12-06 01:58

    You can do this by setting the sharedUserId and sharedUserLabel in the AndroidManifest.xml file to the same value. As an example, if I have the following 2 manifest files (I only included the beginning):

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.package1" 
          android:sharedUserId="userId"
          android:sharedUserLabel="@string/label_shared_user" 
          android:versionCode="1" 
          android:versionName="1.0.0">
    

    and

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.package2" 
          android:sharedUserId="userId"
          android:sharedUserLabel="@string/label_shared_user" 
          android:versionCode="1" 
          android:versionName="1.0.0">
    

    then they will both share the same user.

    0 讨论(0)
提交回复
热议问题