2

my end goal is to have two apps, a "main" app (which will do all the work the user wants it to do), and a "licence" app, which will check if the app is licensed.

my question is, how can i get my licence app (com.example.myapp.licence) to share the same data directory as my main app (com.example.myapp)??

92Jacko
  • 523
  • 2
  • 10
  • 18

1 Answers1

6

You need to modify manifest files for both apps, add the same 'android:sharedUserId' element to both manifest nodes.

e.g.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  android:sharedUserId="com.mycompany.myapp" .... />

If both apps have the same sharedUserId, they can access each other's data folders.

Forgot to add: obviously you need to sign both apps with the same private key with the same alias.

azgolfer
  • 15,087
  • 4
  • 49
  • 46
  • thanks for the response, but i have tried this method previously and i got a "permission denied" error when trying to write data, any idea as to why? – 92Jacko Aug 21 '11 at 16:27
  • See http://stackoverflow.com/questions/5766609/save-internal-file-in-my-own-internal-folder-in-android – Jon Willis Aug 21 '11 at 16:33
  • 2
    my problem was that i had changed the sharedUserId and re-installed without uninstalling the app and clearing all data first, which caused a permission error on existing data. – 92Jacko Aug 25 '11 at 15:52