0
I basically made an application where the user records an audio, and then is presented to him with 2 options, Play and Remove. However my remove function is not working and Logcat neither debug shows error.
Remove function:
deleteAudio(){
if (this.platform.is('ios')) {
this.file.removeFile(this.file.documentsDirectory, this.fileName)
} else if (this.platform.is('android')) {
this.file.removeFile(this.file.externalDataDirectory, this.fileName)
}
}
I’m doing something wrong?
Function call:
<ion-button slot="end" (click)="deleteAudio()">
<ion-icon name="trash"></ion-icon>
</ion-button>
Function that works the callback:
getAudioList() {
if(localStorage.getItem("audiolist")) {
this.audioList = JSON.parse(localStorage.getItem("audiolist")).then( data =>{
console.log('Funciona');
}).catch( error => {
console.log('Erro') ;
});
console.log(this.audioList);
}
}
Both methods did not work and nothing appears in the logs
– rzp
Try to put Alert in the callbacks, like I did now.
– André Lins
I did, he doesn’t call me back. I did a test putting a callback in another function that is already working and it worked, however in the function of deleting the file not.
– rzp
Place the call and how is the other function in the question.
– André Lins
I put in the issue.
– rzp
Try doing without if Else. Maybe the validation might not be right.
– André Lins