multiple apps, sharing same data directory

2019-03-17 01:23发布

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条回答
聊天终结者
2楼-- · 2019-03-17 01:54

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.

查看更多
登录 后发表回答