02-24-2012 12:36 AM
I'm trying to use setControlledAccess in a WebWorks application. I need to download an unprotected file and save it on an SD card encrypted. I am able to create such a file, but can't write to it.
I've created a small JS extension (according to a tutorial) to use setControlledAccess:
final CodeSigningKey key = CodeSigningKey.get(CodeModuleManager.getModuleHand
le("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();
The file is created.
Next, I'm trying to write to that file via PhoneGap (download it via FileTransfer), however, that gives me a ControlledAccessException. Naturally, I've signed my COD file with the XXX key mentioned above. What's wrong?
I'm new to Blackberry and suspect that I've made some stupid newbie mistake but can't see it myself, unfortunately
Solved! Go to Solution.
03-07-2012 10:38 PM - edited 03-07-2012 10:38 PM
I had necessary permissions. The problem, for some obscure reason, was in using Data(Output|Input)Stream instead of plain (Output|Input)Stream.