应用程序数据文件实际存储在android设备上的什么位置?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10811108/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 05:03:26  来源:igfitidea点击:

Where does application data file actually stored on android device?

androidfiletitaniumappcelerator

提问by Bowie

I have developed an Android app using Appcelerator Titanium. This app will create a file in applicationDataDirectory and install a database as well.

我已经使用 Appcelerator Titanium 开发了一个 Android 应用程序。此应用程序将在 applicationDataDirectory 中创建一个文件并安装一个数据库。

If run on emulator, I can locate those files using "adb" command. But how about on Android device? Can I use the "My Files" app to view those file I created? (since I can see files created by other application there.)

如果在模拟器上运行,我可以使用“adb”命令找到这些文件。但是在 Android 设备上呢?我可以使用“我的文件”应用程序查看我创建的文件吗?(因为我可以在那里看到其他应用程序创建的文件。)

Moreover, I expect once I removed the app on device, it will automatically remove the related files and database. Is that true?

此外,我希望一旦我删除了设备上的应用程序,它会自动删除相关文件和数据库。真的吗?

Because I found that even I removed the app from the device, the database seems left behind. I can tell because after deleting app and re-run on device(from Titanium), it show previous data.

因为我发现即使我从设备中删除了该应用程序,数据库似乎也被抛在了后面。我可以说是因为在删除应用程序并在设备上重新运行(来自 Titanium)后,它显示了以前的数据。

I am using Ti SDK 2.0.1GA2, Android Runtime V8. And using Samsung Galaxy Tab for testing. Thanks in advance.

我正在使用 Ti SDK 2.0.1GA2,Android Runtime V8。并使用三星 Galaxy Tab 进行测试。提前致谢。

回答by papaiatis

Application Private Data files are stored within <internal_storage>/data/data/<package>

应用程序私有数据文件存储在 <internal_storage>/data/data/<package>

Files being stored in the internal storage can be accessed with openFileOutput()and openFileInput()

可以使用openFileOutput()openFileInput()访问存储在内部存储器中的文件

When those files are created as MODE_PRIVATEit is not possible to see/access them within another application such as a FileManager.

当这些文件被创建为MODE_PRIVATE 时,不可能在另一个应用程序(如 FileManager)中查看/访问它们。

回答by bizi

On Android 4.4 KitKat, I found mine in: /sdcard/Android/data/<app.package.name>

在 Android 4.4 KitKat 上,我在以下位置找到了我的: /sdcard/Android/data/<app.package.name>

回答by Frictionless

Use Context.getDatabasePath(databasename). The context can be obtained from your application.

使用 Context.getDatabasePath(databasename)。上下文可以从您的应用程序中获取。

If you get previous data back it can be either a) the data was stored in an unconventional location and therefore not deleted with uninstall or b) Titanium backed up the data with the app (it can do that).

如果您取回以前的数据,它可以是 a) 数据存储在非常规位置,因此不会在卸载时删除或 b) Titanium 使用应用程序备份数据(它可以这样做)。

回答by stanley

You can get if from your document_cache folder, subfolder (mine is 1946507). Once there, rename the "content" by adding .pdf to the end of the file, save, and open with any pdf reader.

您可以从 document_cache 文件夹、子文件夹(我的是 1946507)中获取 if。在那里,通过在文件末尾添加 .pdf 来重命名“内容”,保存并使用任何 pdf 阅读器打开。