kentoj
March 11, 2018, 10:12pm
1
Is cordova supposed to be available when running on an Android device from the command line? Maybe I am missing something here.
My barcode scanner plugin works just fine when I deploy the APK to the device yet when I run
ionic cordova run android --device -lcs
I get ReferencError: cordova is not defined
Shola
July 27, 2019, 4:31am
2
i am getting something similar when i try to user base64 for encoding
ReferenceError: device is not defined
at Base64.encodeFile
ReferenceError: device is not defined while using Base64.encodeFile.
How you resolved this error
Shola
May 1, 2020, 11:26am
4
Yes i used another method entirely
Maybe this will help you
async uploadFile(path,filename)
{
const buffer = await this.file.readAsArrayBuffer(path,filename);
const fileBlob = new Blob([buffer], {type: 'image/jpg'});
const randomId = Math.random().toString(36).substring(2,8);
const uploadTask = this.angularStorage.upload(`files/${randomId}.jpg`,fileBlob)
const ref = this.angularStorage.ref(`files/${randomId}.jpg`);
uploadTask.percentageChanges().subscribe(changes =>{
this.uploadProgress = changes;
});
uploadTask.then(res =>{
const downLoadUrl = ref.getDownloadURL().subscribe((url_img) => {
this.submitPostWithImg(url_img);
});
this.presentToast('Upload finished');
});
}
Where is the this.angularStorage.upload came from?