How to access other apk Databases

Source: Internet
Author: User
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.

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.