How to use the plugin : cordova-plugin-file-opener2 ?
Because on the web site the import is : import { FileOpener } from ‘@ionic-native/file-opener’;
This import not work on my project … I use Visual Studio Code and it propose to me :
import { FileOpener } from ‘ionic-native/dist/es5’;
import { FileOpener } from ‘ionic-native/dist/esm’;
And when i use this import, i have an error on open and the error is : “Property ‘open’ does not exist on type 'FileOpener”
My code :
//import { FileOpener } from ‘ionic-native/dist/esm’; → does not work
//import { FileOpener } from ‘ionic-native/dist/es5’; → does not work
//import { FileOpener } from ‘ionic-native’; → does not work
//import { FileOpener } from ‘ionic-native/file-opener’; → does not work
Ok thank you @SigmundFroyd
I see i have not execute the line : npm install --save @ionic-native/file-opener
So i tried this line in my shell and i have many warning : ±- UNMET PEER DEPENDENCY @angular/common@2.4.8 ±- UNMET PEER DEPENDENCY @angular/core@2.4.8 ±- UNMET PEER DEPENDENCY @angular/platform-browser@2.4.8 ±- UNMET PEER DEPENDENCY @ionic-native/core@^3.1.0 ±- @ionic-native/file-opener@3.4.4 `-- UNMET PEER DEPENDENCY rxjs@5.0.1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”}) npm WARN @angular/router@3.2.4 requires a peer of @angular/core@2.2.4 but none was installed. npm WARN @angular/router@3.2.4 requires a peer of @angular/common@2.2.4 but none was installed. npm WARN @angular/router@3.2.4 requires a peer of @angular/platform-browser@2.2.4 but none was installed. npm WARN @angular/router@3.2.4 requires a peer of rxjs@5.0.0-beta.12 but none was installed. npm WARN @ionic-native/file-opener@3.4.4 requires a peer of @ionic-native/core@^3.1.0 but none was installed.
So i think this is not very important.
But when i check my code this the good params, in my inspector of my browser i have this error : Uncaught Error: Cannot find module “@ionic-native/core”
thank you @rapropos
So I create a new project and I export my file in this new project. I have not problem today, I think my last project is corrompt …
Today I test this plugin on 2 device : one device is on Android 5.1 (Galaxy Core Prime) and other device is on Android 7.0 (Samsun Galaxy S6 Edge +) .
When I tried this simple code : import { FileOpener } from ‘@ionic-native/file-opener’; constructor(private fileOpener: FileOpener) {}