从
http://developer.android.com/guide/topics/fundamentals.html:
It’s possible to arrange for two applications to share the same Linux
user ID,in which case they are able to access each other’s files. To
conserve system resources,applications with the same user ID can also
arrange to run in the same Linux process and share the same VM (the
applications must also be signed with the same certificate).
我们如何为两个应用程序实现相同的用户ID?任何例子?
解决方法
您可以通过将AndroidManifest.xml文件中的sharedUserLabel和sharedUserId设置为相同的值来实现此目的.例如,如果我有以下2个清单文件(我只包括开始):
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:sharedUserLabel="@string/label_shared_user" android:sharedUserId="com.example" package="com.example.package1" android:versionName="2.0.0" android:versionCode="2">
和
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:sharedUserLabel="@string/label_shared_user" android:sharedUserId="com.example" package="com.example.package2" android:versionName="1.0.0" android:versionCode="1">
那么他们将共享同一个用户.