I am getting this error when I am trying to open DOC file by fileOpener. Error opening file: {"status":9,"message":"Activity not found: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://io.ionic.starter.opener.provider/external-cache/Complex Numbers.docx typ=application/vnd.openxmlformats-officedocument.wordprocessingml.document flg=0x40000003 }"} I am trying with this code: ViewDocFile(file_name){ let fileExtn=file_name.split('.').reverse()[0]; let fileMIMEType=this.getMIMEtype(fileExtn); this.file.copyFile(this.file.applicationDirectory + 'www/assets/doc/', file_name, this.file.externalCacheDirectory, file_name) .then( _ => { this.fileOpener.open(this.file.externalCacheDirectory + file_name, fileMIMEType) .then( _ => { console.log('File opened'); }) .catch(e => console.log("Error opening file: " + JSON.stringify(e))); }) .catch( e => { console.log("Error copying file: " + JSON.stringify(e)); }); } getMIMEtype(extn){ let ext=extn.toLowerCase(); let MIMETypes={ 'txt' :'text/plain', 'docx':'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'doc' : 'application/msword', 'pdf' : 'application/pdf', 'jpg' : 'image/jpeg', 'bmp' : 'image/bmp', 'png' : 'image/png', 'xls' : 'application/vnd.ms-excel', 'xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'rtf' : 'application/rtf', 'ppt' : 'application/vnd.ms-powerpoint', 'pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation' } return MIMETypes[ext]; } I am not getting any result, but this code work for PDF fine. Problem with doc/docx files.
Question and answer is powered by AnsPress.io