multiple apps, sharing same data directory

旧街凉风 提交于 2020-01-12 04:01:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!