Satyam Gupta
Satyam Gupta

Reputation: 11

Ionic Cordova SQLite works fine on real Devices but does not work persistent in browser or emulator

I have installed the Cordova SQLite plugin to access the database. but Ionic Cordova SQLite works fine on real devices but does not work persistent in browser or emulator.

It displays error:

Uncaught (in promise): cordova_not_available.

enter image description here

Upvotes: 1

Views: 472

Answers (1)

Dmytro Grynets
Dmytro Grynets

Reputation: 953

It will never work in browser as browser does not have SQLite database. Also almost all plugins(eg. statusbar, splashscreen) won't work in browser as browser is not a real device and all calls to any native api will fail. Yet it should work in emulator if running like 'ionic cordova run ios'.

Get used to testing functionality on real device/simulator, it will save you a lot of time later

Also if you want to use browser features like console or element tree viewing you could use chrome dev tools to inspect android device, and safari to inspect ios device

If you kind of really really need sql database in browser, there is typeorm(or any other kind of this, i'm just aware of this one) which provides abstraction of such things as database implementation

Upvotes: 1

Related Questions