I've been trying without success to write a file to the Android phone.
Here is my code:
<script type="text/javascript">
var fileName = "test.txt";
var platform = MobileCRM.bridge.platform;
var path = "./test/" + fileName;
alert(platform);
if (platform == "Android" || platform == "iOs")
path = "../storage/extSdCard/Android/data/test/" + fileName;
alert(path);
function File() {
// Check if Directory exist and contains file.
MobileCRM.Application.fileExists(path, function (exist) {
if (!exist)
alert("File not found.");
else
alert("File does exists!");
Write("Test.");
}, MobileCRM.bridge.alert, null)
}
function Write(text)
{
alert(text);
MobileCRM.Application.writeFile(path, text, true, function (success) { alert(success); }, MobileCRM.bridge.alert, null);
}
</script>
I created the file, but the function is not working!
What am i doing wrong?