![]() ![]() To use SQLite in Capacitor, there are three options: Operations are written in the SQL query language and SQLite generally follows the PostgreSQL syntax. SQLite is a SQL based relational database written in C that was crafted to be embed inside of applications. But in Capacitor iOS and Android, you should not rely on these. Storing data in these storages can be done in browsers, because there is no other option. Therefore you cannot 100% rely on the persistence of the stored data and your application needs to expect that the data will be lost eventually. But the default browser behavior is to clean up these storages regularly when they are not in use for a long time or the device is low on space. Since Capacitor apps run in a web view, Web APIs like IndexedDB, Localstorage and WebSQL are available. Complex queries or other features like indexes or replication are not supported which makes the preferences API not suitable for anything more then storing simple data like user settings. The preferences API is good when only a small amount of data needs to be stored and when no query capabilities besides the key access are required. Notice that all calls to the preferences API are asynchronous so they return a Promise that must be await-ed. To use it, you first have to install it from npm npm install and then you can import it and write/read data. NOTICE: You are reading this inside of the RxDB documentation, so everything might be opinionated.ĭatabase Solutions for Capacitor Preferences API Ĭapacitor comes with a native Preferences API which is a simple, persistent key->value store for lightweight data, similar to the browsers localstorage or React Native AsyncStorage. To read and write persistent data in Capacitor, there are multiple solutions which are shown in the following. Compared to React Native, Capacitor is more Web-Like because the JavaScript runtime supports most Web APIs like IndexedDB, fetch, and so on. ![]() ![]() It is developed by the Ionic Team and provides a great alternative to create hybrid apps. You can use it to create cross-platform iOS, Android, and Progressive Web Apps with the web technologies JavaScript, HTML, and CSS. Capacitor Database - SQLite, RxDB and othersĬapacitor is an open source native JavaScript runtime to build Web based Native apps. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |