3
votes

I'm trying to open PDF file in ionic with @ionic-native/file-opener and getting cordova problem.

Native: tried calling FileOpener.open, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

How can I solve it?

3
Have you tried using ionic serve? - LordColus
yes, i have.... - liskior
Did you receive the same error? - LordColus
yes............ - liskior
Take a look at this thread: stackoverflow.com/questions/38744657/… - LordColus

3 Answers

5
votes

The only way to make cordova available is run the platform browser.

$ ionic cordova run browser 
2
votes

Are you running in a browser or emulator? You can use the Ionic CLI to run in an emulator, like so:

ionic cordova run android

If you have Cordova and the Android SDK set up, it should launch the emulator.

2
votes

Copying @AjayGupta's answer from this thread:

If you want the plugin to work for the browser you should add platform browser and run it:

ionic cordova platform add browser and run it:

ionic cordova run browser instead of ionic serve.