FileReader onload is not running in android, but runs well in web.
How can I solve this problem?
help me!!!
file-service.ts
import { Injectable } from '@angular/core';
import * as XLSX from 'xlsx';
type AOA = Array<Array<any>>;
@Injectable()
export class FileService {
constructor() {}
async uploadExcel(file: File): Promise<AOA> {
return new Promise<AOA>((resolve, reject) => {
let data: AOA = [];
console.log("uploadExcel - file: " + file.name);
/* wire up file reader */
const reader = new FileReader();
reader.onload = (e: any) => {
console.log("This log does not print in android.");
...
...
resolve(data);
};
reader.readAsBinaryString(file);
});
}
}
ionic Info
cli packages:
@ionic/cli-utils : 1.12.0
ionic (Ionic CLI) : 3.12.0
global packages:
cordova (Cordova CLI) : 7.0.1
local packages:
@ionic/app-scripts : 2.1.3
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.6.0
System:
Android SDK Tools : 26.0.2
Node : v6.10.3
npm : 5.3.0
OS : Windows 10