问题
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)??
回答1:
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.
来源:https://stackoverflow.com/questions/7139421/multiple-apps-sharing-same-data-directory