2012-02-22 57 views
0

我試圖在WebWorks應用程序中使用setControlledAccess。我需要下載一個不受保護的文件並將其保存在加密的SD卡上。我能夠創建這樣一個文件,但不能寫入它。在WebWorks中使用setControlledAccess

我創建了一個小JS擴展使用setControlledAccess:創建

final CodeSigningKey key = CodeSigningKey.get(CodeModuleManager.getModuleHandle("xxx"), "XXX"); 
if (key == null) 
    // do something 
ExtendedFileConnection file = (ExtendedFileConnection)Connector.open(fileName); 
// omitted a check for file existence 
file.setControlledAccess(key); 
file.create(); 
file.close(); 

文件。

接下來,我試圖通過PhoneGap寫入該文件(通過FileTransfer下載),但是,這給了我一個ControlledAccessException。當然,我已經用上面提到的XXX密鑰簽署了我的COD文件。怎麼了?

我新的黑莓和懷疑,我做了一些愚蠢的新手的錯誤,但無法看到它自己,遺憾的是:(

回答

0

的問題,對於一些模糊的原因,是使用Data(Output|Input)Stream代替普通(Output|Input)Stream