Search code examples
javascripthtmlhybrid-mobile-app

Offline connection of android Hybrid application to database


I'm trying to convert the web application in to android i.e., to hybrid application and wanted to access the database . I'm using Html5, css and JavaScript to develop hybrid application. Now, i wanted to connect to the sqlite3 database which is present locally in the phone without internet connection i.e., via offline.

Anyone please help me on how to connect this app to database with out internet connection(OFFLINE). I checked node.js it is showing how to connect to external server but not Internal.

If i got the answer then only i can able to move further.

Thankyou


Solution

  • Offline storage for hybrid applications is going to come in 2 flavors, Web and Native. To access the Native storage (like sqlite) you'll need a native component. You'll then call that component from your javascript. You can't access the device storage directly from a WebView for security reasons.

    You can write your own in Android (Java). Or use a framework that provides these wrappers like PhoneGap

    Web includes localStorage, sessionStorage, and IndexedDB You can access these directly from your WebView with javascript. This is the fastest to build but you're limited on space/data-complexity.