访问其他应用程序内部数据
我知道这个问题已经在某个时候进行过讨论。但经过搜索后,对该主题仍然存在一些疑问。
我的情况: 我有一个应用程序 A,它生成信息并将其存储在其内部存储中。 应用程序 B 应该访问应用程序信息。 关键是应用程序 A 是在考虑应用程序 B 的需求之前设计的。 同样重要的是: 如果可能的话,应用程序 A 不应被修改。
我发现:
- 内容提供程序:发生很大变化
- 访问另一个应用程序的数据库
- 将信息存储在 SD 上:最后一种可能性
- 应用程序对内部存储上的文件的访问权限
问题要点二: 那里写着:
要共享受保护的文件,应用程序必须使用相同的证书进行签名,并且在其 AndroidManifest.xml 文件中具有匹配的 android:sharedUserId。
我明白了 sharedUserId 的意思,但是什么他指的是证书吗?
第三点问题: 如果应用程序 A 使用不同的 Context.MODE 保存,是否有办法访问它的信息?
我真的很感激你们的一些想法。 谢谢。
I know it have been discussed already at some point. But after searching there are still some questions to that topic.
My situation:
I have an App A which generates information and stores it in it's internal storage.
App B is supposed to access App As information.
The point is that App A was designed before considering a need of App B.
Also important:
App A shouldn't get modified if it's possible.
What I found:
- Content Provider: to much changes
- Access database of another app
- store the Inforation on SD: last possibility
- Application access permission to files on internal storage
Question to point two:
there is written:
For sharing protected files the applications must be signed with the same cert and have matching android:sharedUserId in their AndroidManifest.xml files.
I get the point with the sharedUserId, but what certificate is he refering to?
Question to point three:
Is there a way to access the Information of App A if it gets saved with a different Context.MODE ?
I really would appreciate some thoughts of you guys.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对你来说幸运的是,这是不可能的。否则,每个人都可以随时获取应用程序 A 的数据。
这将是您的应用程序签名所用的签名密钥。例如,对于生产,它将是您用于 Android Market 的签名密钥。
请记住,您无法在不破坏所有现有用户的情况下更改应用 A 的
sharedUserId
。 Google 也不建议 SDK 开发人员乱用sharedUserId
。Context.MODE
与外部存储无关。每个应用程序都可以在外部存储上读取(并且使用WRITE_EXTERNAL_STORAGE
写入)它们想要的任何内容。Context.MODE
与内部存储 (openFileOutput()
) 一起发挥作用。但是,如果您使该文件可供所有人读取,那么任何应用程序都可以读取该数据,而不仅仅是应用程序 B。这或者可能是具有 AIDL 接口的服务是最好的答案,您可以在其中使用自定义权限来帮助确保只有应用程序 B 可以访问应用程序 A 的数据。
Fortunately for you, that's impossible. Otherwise, everybody could get at App A's data whenever they want.
That would be the signing key your application is signed with. For production, it would be the signing key you used for the Android Market, for example.
Bear in mind that you cannot change the
sharedUserId
of App A without breaking all of your existing users. Google also does not recommend that SDK developers mess around withsharedUserId
.Context.MODE
has nothing to do with external storage. Every application can read (and, withWRITE_EXTERNAL_STORAGE
, write) anything they want on external storage.Context.MODE
comes into play with internal storage (openFileOutput()
). However, if you make the file world-readable, then any application can read that data, not just App B.This, or possibly a service with an AIDL interface, is the best answer, where you use a custom permission to help ensure that only App B can access App A's data.