Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8345197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:36:19+00:00 2026-06-09T06:36:19+00:00

I am trying to implement this great technique of sharing preferences across two different

  • 0

I am trying to implement this great technique of sharing preferences across two different applications while still MODE_PRIVATE.

My problem is that the first application cannot assume that the first application is installed (and vice versa) and so:

 Context c = createPackageContext("com.app.first", MODE_PRIVATE);

Must be replaced by:

 Context c = createPackageContext("com.app.shared", MODE_PRIVATE);

But that mandates adding that com.app.shared for real, which translates into a second APK?

In other words, there is only one AndroidManifest.xml per APK and only one <manifest package= > per manifest file. Therefore only one actual package per APK?

I don’t want 2 APKs per application, I only want a single APK per application.

Is there a way to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:36:22+00:00Added an answer on June 9, 2026 at 6:36 am

    I am trying to implement this great technique of sharing preferences across two different applications while still MODE_PRIVATE.

    Actually, that is such an anti-great technique that I just deleted my answer. Using android:sharedUserId is risky, and downright impossible for already-deployed apps. I learned the error of my ways in the two years since I had posted my answer there.

    Also, the technique doesn’t work reliably, because you have no control over which apps the user installs… and uninstalls. If App A and App B share preferences by means of both using App A’s copy, then when the user uninstalls App A, App B is hosed.

    Therefore only one actual package per APK?

    Correct.

    I don’t want 2 APKs per application, I only want a single APK per application.

    For two applications, you have two APK files, each with their own package name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement a circular buffer in C, and have come across this
I hope I can explain this problem decently well! I'm trying to implement a
I'm trying to implement this algorithm description from a previous question I had here
I'm trying to implement this example http://jsfiddle.net/gzF6w/1/ (from another question here on stak) on
I am trying to implement this package http://code.google.com/p/python-progressbar/ when downloading a file like below:
I am trying to implement this bit of code: func factorial(x int) (result int)
I'm trying to implement this web api autocomplete in a standard mvc app. http://techbrij.com/987/jquery-ui-autocomplete-asp-net-web-api
I'm trying to implement this pattern in my WinForms application (I don't like it,
I am trying to implement this demo on my local machine. http://bit.ly/4g4o1r I have
I'm trying to implement this scenario using Unity and i can't figure out how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.