2012-01-09 106 views

回答

4

它存儲在這裏:

Environment.getSystemSecureDirectory().getPath() + File.separator + DATABASE_NAME; 

其中getSystemSecureDirectory:

獲取可用於安全存儲系統目錄下。如果已加密 已啓用文件系統,則會返回加密目錄 (/ data/secure/system)。否則,它將返回未加密的 /data/system目錄。

DATABASE_NAME = "accounts.db";

+0

感謝您的及時響應! – Guna 2012-01-09 08:52:46

+0

在更新的版本上有多個用戶配置文件支持,您可以在'/ data/system/users/0/accounts.db'找到數據庫,用實際用戶編號替換'0'。 – rymo 2014-04-20 04:56:15

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 
*/ 

隱藏的方法只能通過與該平臺本身一起分發平臺的應用程序意味着使用。作爲Play/Market的應用程序,它們是針對平臺來源而非SDK來源進行編譯的。

這意味着如果您想在Play/Market上發佈您的應用,則不允許使用它。

相關問題