File Opener
This plugin will open a file on your device file system with its default application.
Repo: https://github.com/pwlin/cordova-plugin-file-opener2
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-plugin-file-opener2 $ npm install --save @ionic-native/file-opener@4
- Add this plugin to your app's module
Supported platforms
- Android
- iOS
- Windows
- Windows Phone 8
Usage
import { FileOpener } from '@ionic-native/file-opener';
constructor(private fileOpener: FileOpener) { }
...
this.fileOpener.open('path/to/file.pdf', 'application/pdf')
.then(() => console.log('File is opened'))
.catch(e => console.log('Error opening file', e));
Instance Members
open(filePath, fileMIMEType)
Open an file
Param | Type | Details |
---|---|---|
filePath |
string
|
File Path |
fileMIMEType |
string
|
File MIME Type |
Returns: Promise<any>
uninstall(packageId)
Uninstalls a package
Param | Type | Details |
---|---|---|
packageId |
string
|
Package ID |
Returns: Promise<any>
appIsInstalled(packageId)
Check if an app is already installed
Param | Type | Details |
---|---|---|
packageId |
string
|
Package ID |
Returns: Promise<any>