多个应用程序,共享相同的数据目录 [英] multiple apps, sharing same data directory

查看:129
本文介绍了多个应用程序,共享相同的数据目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的最终目标是让两个应用程序,一个主的应用程序(这将尽一切用户想要它做的工作),以及许可证的应用程序,这将检查应用程序的许可。

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.

我的问题是,我怎么能得到我的许可应用程序(com.example.myapp.licence)共享同一数据目录作为我的主要的应用程序(com.example.myapp)??

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)??

推荐答案

您需要修改清单文件,这两个应用程序,添加相同的机器人:sharedUserId元素,既体现节点。

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

例如。

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

如果这两个应用程序具有相同的sharedUserId,他们可以互相访问的数据文件夹。

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.

这篇关于多个应用程序,共享相同的数据目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆