Backendless.UserService.login( userid, pwd );
// this will return user only if there is explicit Backendless.UserService.login
// call in the current session
var user = Backendless.UserService.getCurrentUser();
console.log( "user " + user );
// this will return objectId of the logged in user
// the value is available when stayLoggedIn is either true or false
var userObjId = Backendless.UserService.loggedInUser();
console.log( "user obj id - " + userObjId );
I am not sure what is means to “compile Cordova application for Android”. What would be very helpful for us is if you could describe how to reproduce the problem by using an API from our library.
What does the app do when the error happens? What API does it use? What are the argument values? This would let us pin point the problem and then fix it.
As for the problem with :ERR_FILE_NOT_FOUND", it sounds like it references a file which does not exist.
Apache Cordova is a platform for building native mobile applications using HTML, CSS and JavaScript. I am also using the Angularjs.
I’m using Backendless SDK v2.0.1 for JavaScript. Everything is working, however the Backendless.Files.saveFile() is not working when I compile my project on Android.
var byteArray = new Blob([‘foo bar’]);
var savedFile = Backendless.Files.saveFile( “testfolder”, “fox.txt”, byteArray, true, new Backendless.Async(function(e){
console.log(‘sucesso’, e);
}, function(e){
console.log(‘erro’, e);
}));
Try/Catch and Async not work. You need more details?
In Files.prototype.saveFile() we have:
var reader = new FileReader();
reader.fileName = fileName;
reader.uploadPath = baseUrl;
reader.onloadend = sendEncoded;
if (async) {
reader.asyncHandler = async;
}
Yes, but reader.fileName, reader.uploadPath and reader.asyncHandler when called in sendEncoded() they come as ‘undefined’. I did like this and it worked:
I declared
var readerFileName = null;
var readerUploadPath = null;
var readerAsyncHandler = null;
Files.prototype.saveFile()
var reader = new FileReader();
/*reader.fileName = fileName;*/
/*reader.uploadPath = baseUrl;*/
readerFileName = fileName;
readerUploadPath = baseUrl;
reader.onloadend = sendEncoded;
if (async) {
/*reader.asyncHandler = async;*/
readerAsyncHandler = async;
}
reader.onerror = function (evn) {
async.fault(evn);
};
reader.readAsDataURL(fileContent);
if (!async) {
return true;
}
I am hesitating to make these changes - declaring global variables just to pass the data into an asynchronous callback is a bad practice.
I’d like to be able to reproduce the error on our side. I tried all browsers on desktop (Chrome, Safari, Firefox) and it works everywhere. You mentioned it breaks in a mobile deployment. Could you please let me know the steps to reproduce the issue? If you could provide an example we could just run, it would go a long way.
Hi guys , I have the same problem with Backendless.Files.upload(files, directory, override, async) using inside Ionic platform… on browser it work fine but on device I have problem here: “xhr.open(“POST”, this.uploadPath, true);” this.uploadPath return undefined inside send function in backendless.js
Sorry for my bad english and thanks a lot for your support.
Have you tried stepping into the code (including our code) to see where the error occurs? We made our libraries open source and value community involvement greatly!
Hi Mark,
thanks for answer… I just already mentioned that error occurs in your code in backendless.js when this.uploadPath return undefined but I don’t know how to correct it! Have you any suggestions?
If you provide some example code which reproduces the described behaviour, it would help much.
In what cases does the uploadPath appear to be undefined?