简体   繁体   English

访问其他应用程序内部数据

[英]Access other apps internal data

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 A,它可以生成信息并将其存储在内部存储器中。 App B is supposed to access App As information. App B应该访问App As信息。 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. 关键是应用A在设计之前就已经考虑了对应用B的需求。同样重要的是:如果可能,则不应对应用A进行修改。


What I found: 我发现:

  1. Content Provider: to much changes 内容提供者:变化很大
  2. Access database of another app 访问另一个应用程序的数据库
  3. store the Inforation on SD: last possibility 将Inforation存储在SD上:最后一种可能性
  4. 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. 为了共享受保护的文件,应用程序必须使用相同的证书签名,并且在其AndroidManifest.xml文件中具有匹配的android:sharedUserId。

I get the point with the sharedUserId , but what certificate is he refering to? 我知道了sharedUserId ,但是他指的是什么证书?

Question to point three: Is there a way to access the Information of App A if it gets saved with a different Context.MODE ? 问题三:如果使用不同的Context.MODE保存了应用程序A的信息,是否可以访问该信息?

I really would appreciate some thoughts of you guys. 我真的很感谢你们的一些想法。 Thanks. 谢谢。

Also important: App A shouldn't get modified if it's possible. 同样重要的是:如果可能,不应修改AppA。

Fortunately for you, that's impossible. 幸运的是,这是不可能的。 Otherwise, everybody could get at App A's data whenever they want. 否则,每个人都可以随时获取应用程序A的数据。

I get the point with the sharedUserId, but what certificate is he refering to? 我知道了sharedUserId,但是他指的是什么证书?

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. 例如,对于生产来说,这将是您用于Android Market的签名密钥。

Bear in mind that you cannot change the sharedUserId of App A without breaking all of your existing users. 请记住,您必须更改所有现有用户才能更改应用程序A的sharedUserId Google also does not recommend that SDK developers mess around with sharedUserId . Google也建议SDK开发人员不要使用sharedUserId

Question to point three: Is there a way to access the Information of App A if it gets saved with a different Context.MODE ? 问题三:如果使用不同的Context.MODE保存了应用程序A的信息,是否可以访问该信息?

Context.MODE has nothing to do with external storage. Context.MODE与外部存储无关。 Every application can read (and, with WRITE_EXTERNAL_STORAGE , write) anything they want on external storage. 每个应用程序都可以读取(并使用WRITE_EXTERNAL_STORAGE写入)外部存储上想要的任何内容。

Context.MODE comes into play with internal storage ( openFileOutput() ). Context.MODE在内部存储( openFileOutput() )中起作用。 However, if you make the file world-readable, then any application can read that data, not just App B. 但是,如果使文件可全球读取,则任何应用程序都可以读取该数据,而不仅仅是AppB。

Content Provider: to much changes 内容提供者:变化很大

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. 最好的答案是此功能,或者可能是带有AIDL接口的服务,在此您可以使用自定义权限来帮助确保只有App B可以访问App A的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM