Sometimes we install two products of a company. When we log on to software, when we open software B and want to log on automatically, We need to access the database of a. to access the database, we must set the shareduserid in the configuration file to the same, for example: both APKA and APKB are products of Company C.
Sometimes we install two products of a company. When we log on to software, when we open software B and want to log on automatically, We need to access the database of a. to access the database, we must set the shareduserid in the configuration file to the same, for example: both apk a and apk B are products of Company C.
Sometimes we install two products of a company.
When we log on to software a, we want to log on automatically when we open software B.
In this case, you need to access database.
To access the database, you must set the shareduserid in the configuration file to the same
For example, if both apk a and apk B are products of Company C, you can log in from APK A successfully. Then
You do not need to log in again when opening apk B. The specific implementation is to set A and B to the same User ID:
AndroidManifest of packagename apk:
Package = "com. Android. demo. a1"
Android: sharedUserId = "com. c">
AndroidManifest of packagename apk:
Package = "com. Android. demo. b1"
Android: sharedUserId = "com. c">
This "com. c" is the user id. Apk B can open the database in APK A just like opening the local database.
Apk a stores login information
In apk B, the packagecontext OF A can be obtained through the package name of:
FriendContext = this. createPackageContext ("com. android. demo. a1 ",
Context, CONTEXT_IGNORE_SECURITY );
With this context, you can directly open the database.