简体   繁体   English

Android和内部存储内存

[英]Android & internal storage memory

If my application makes a file & stores it in the internal memory of the application ie in the path <internal_storage>/data/data/<package> , if I uninstall the application will the file that I stored be removed from the location? 如果我的应用程序生成文件并将其存储在应用程序的内部存储器中,即路径<internal_storage>/data/data/<package> ,如果我卸载该应用程序,我存储的文件是否将从该位置删除? Also while writing the file if I give any mode(world_readable, world_writable seems to have been deprecated) can any application like file manager see the file that I have created? 另外,在写文件时,如果我给出任何模式(world_read,world_writable似乎已被弃用),文件管理器之类的任何应用程序都可以看到我创建的文件吗? I have done a lot of research on this topic which has not helped me significantly. 我对此主题做了很多研究,但对我没有太大帮助。

If I uninstall the application will the file that I stored be removed from the location? 如果我卸载该应用程序,将会从该位置删除我存储的文件吗?

Yes. 是。

Also while writing the file if I give any mode(world_readable, world_writable seems to have been deprecated) can any application like file manager see the file that I have created? 另外,在写文件时,如果我给出任何模式(world_read,world_writable似乎已被弃用),文件管理器之类的任何应用程序都可以看到我创建的文件吗?

  • MODE_PRIVATE : the default mode, where the created file can only be accessed by the calling application (or all applications sharing the same user ID). MODE_PRIVATE :默认模式,其中创建的文件只能由调用应用程序(或共享相同用户ID的所有应用程序)访问。

  • MODE_APPEND : for use with openFileOutput(String, int) , if the file already exists then write data to the end of the existing file instead of erasing it. MODE_APPEND :与openFileOutput(String, int) ,如果文件已存在,则将数据写入现有文件的末尾而不是擦除它。

  • MODE_WORLD_READABLE : allow all other applications to have read access to the created file. MODE_WORLD_READABLE :允许所有其他应用程序对创建的文件具有读取权限。

  • MODE_WORLD_WRITEABLE : allow all other applications to have write access to the created file. MODE_WORLD_WRITEABLE :允许所有其他应用程序对创建的文件具有写访问权。

For the last two modes (which are both deprecated), the following should be taken into consideration: 对于后两种模式(均已弃用),应考虑以下因素:

Creating world-readable files is very dangerous, and likely to cause security holes in applications. 创建世界可读的文件非常危险,并且可能会导致应用程序中的安全漏洞。 It is strongly discouraged; 强烈建议不要这样做。 instead, applications should use more formal mechanism for interactions such as ContentProvider , BroadcastReceiver , and Service . 相反,应用程序应使用更正式的机制进行交互,例如ContentProviderBroadcastReceiverService There are no guarantees that this access mode will remain on a file, such as when it goes through a backup and restore. 无法保证此访问模式将保留在文件上,例如在进行备份和还原时。

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

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