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

  • SEARCH
  • Home
  • 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 7086315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:32:04+00:00 2026-05-28T07:32:04+00:00

First of all I have done a search and can’t find a specific answer

  • 0

First of all I have done a search and can’t find a specific answer to my question so here goes…

I am writing my first Android application and plan to have a Lite version (limited features) and a paid version (full features).

The Lite and Pro version will use the same SQLite database structure, and if the user starts with the Lite version and upgrades to the Pro version, I dont want them to lose the data they have created in the Lite version.

As the Lite and Pro versions will (from my understanding) have to be in separate packages to allow the Android Market to distinguish between them, how can the Pro version see the Lite database?

Many thanks in advance for your answers.

  • 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-05-28T07:32:04+00:00Added an answer on May 28, 2026 at 7:32 am

    What I did in and it seems to work for Hexaddicus, is have both Lite and Pro versions run as the same user and then on the first time run of the Pro version, copy the Lite database over. Then inform the user of the copy.

    Set the android:sharedUserId to be the same in both products…

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.mycompany.package"
          android:sharedUserId="com.mycompany.package" <---- IMPORTANT
          android:versionCode="10"
          android:versionName="@string/app_version"
          android:installLocation="auto">
    

    And then the code to copy the DB…

        try {
            final Context free_context = this.createPackageContext("com.mycompany.package", Context.CONTEXT_INCLUDE_CODE);
            final File    full_db      = this.getDatabasePath(GameData.DATABASE_NAME);
            final File    full_db_dir  = full_db.getParentFile();
            final File    free_db      = free_context.getDatabasePath(GameData.DATABASE_NAME);
            final File    free_db_dir  = free_db.getParentFile();
    
            if (free_db.exists() == false)     return;
            if (full_db_dir.exists() == false) full_db_dir.mkdir();
            if (full_db.exists() == false)     full_db.createNewFile();
    
            FileUtils.copyDirectory(free_db_dir, full_db_dir);
            this.gameData.getWritableDatabase();
        }
        catch (NameNotFoundException e) {
            /* do nothing here since this is an semi expected case */
            Log.w("mytag", "No Lite version found");
        } catch (IOException e) {
            Log.w("mytag", "Failed to create file");
        }
    }
    

    The only downside of this is that once the copy is done, there is no syncing between the two versions. You also have to make sure that the user of the Lite version is running a version that is running as the sharedUserId or the copy will fail.

    Update: please consider ChrisCashwells comments and answer too since he brings up a valid point and I can’t remember what I did in his example.

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

Sidebar

Related Questions

First of all, I have done some search yet found no working way. Anyway,
This is my first question that I haven't been able to find an answer
Here's my new question: On a search results page we have 12 products shown.
First of all I have many Django instances setup and running like this. In
First of all I have searched many times in this forum but none is
First of all I have to say I am new to iOS development. My
First of all i have frames on my SD Card and frames are there
First of all i have to clear few things 1.This is not spam group
So first of all I have such image (and ofcourse I have all points
Hi guys first of all I have no expirience with DB programing only basic

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.