简体   繁体   English

如何临时访问内部存储中的某些文件给其他应用程序?

[英]How to give temporary access to some files on internal storage to other applications?

I have application A and application B, than I have some file on the A application and I want to make the file available for app B. The file is in the internal storage in the private app data. 我有应用程序A和应用程序B,而不是应用程序A上有一些文件,并且我想使该文件可用于应用程序B。该文件位于私有应用程序数据的内部存储中。 What should I do ? 我该怎么办 ? Is there some permission to give to the file ? 是否有授予该文件的权限? is there some specific way of creating intents ??? 有一些创建意图的特定方法吗?

how does work the process for these kinds of files, I mean if it was a file in the sdcard would be very easy .... 这些文件的处理过程如何工作,我的意思是,如果它是sdcard中的文件,将非常容易....

You need to use a Content Provider in your app. 您需要在应用程序中使用内容提供程序。

From the Android Dev page: 在Android开发人员页面上:

Content providers store and retrieve data and make it accessible to all applications. 内容提供商可以存储和检索数据,并使所有应用程序都可以访问它。 They're the only way to share data across applications; 它们是跨应用程序共享数据的唯一方法。 there's no common storage area that all Android packages can access. 没有所有Android软件包都可以访问的公用存储区。

Of course, Application B will need to be aware of your provider and able to use it. 当然,应用程序B需要了解您的提供者并能够使用它。

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

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