AccountManager帐户存储在哪里?它在设备上吗?如果是,它存储在哪个文件夹中?
答案 0 :(得分:4)
它存储在这里:
Environment.getSystemSecureDirectory().getPath() + File.separator + DATABASE_NAME;
getSystemSecureDirectory:
获取可用于安全存储的系统目录。如果加密 文件系统启用后,返回加密目录 (/数据/安全/系统)。否则,它返回未加密的 / data / system目录。
和DATABASE_NAME = "accounts.db";
答案 1 :(得分:1)
虽然答案是完全正确的,但您应该记住'Environment.getSystemSecureDirectory()'是一种平台API方法,而不是公共SDK API的一部分。如果你看看它的javadoc,你会发现'@hide'注释:
/** * Gets the system directory available for secure storage. * If Encrypted File system is enabled, it returns an encrypted directory (/data/secure/system). * Otherwise, it returns the unencrypted /data/system directory. * @return File object representing the secure storage system directory. * @hide */
隐藏方法仅供与平台本身一起分发的平台应用程序使用。它们是根据平台源而不是SDK源编译的,因为Play / Market的应用程序必须是。
这意味着如果您想在Play / Market上发布应用,则不允许使用它。