使用 delphi 从 Android 内部存储中读取文件

read files from in Android internal storage using delphi

是否可以从 android /data/data/.... 的内部存储中读取 file.db 使用 android firemonkey 应用程序使用 delphi 而不是 java?,我尝试从内部存储打开文件,但即使我的设备已 Root,访问也被拒绝! 任何帮助将不胜感激。非常感谢。

存储在内部存储中的文件对于创建它们的应用程序是私有的。您的应用无法访问其他应用的内部存储文件,除非该应用在创建文件时明确授予访问权限。这在 Android 文档中有明确说明:

Using the Internal Storage

By default, files saved to the internal storage are private to your application and other applications cannot access them (nor can the user).

当应用程序在内部存储中创建文件时(使用 Context.openFileOutput()), it choose whether to use 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_WORLD_READABLE and/or MODE_WORLD_WRITEABLE权限:

allow all other applications to have read access to the created file.

allow all other applications to have write access to the created file.

没有这些权限,您的应用程序将无法访问其他应用程序的文件。另请注意,这些权限在 API 级别 17:

中已 弃用

Creating world-(readable|writable) 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. There are no guarantees that this access mode will remain on a file, such as when it goes through a backup and restore.