Access localStorage or web database created in PhoneGap from Android native code

强颜欢笑 提交于 2020-01-11 08:50:32

问题


How is it possible to access Web SQL database created in PhoneGap app from native code in Android?

I have a local notification plugin set up and what I want to achieve is fetch user setting from web database to set a correct interval for my alarm.


回答1:


I have modified the Cordova(https://github.com/Coder-Nasir/incubator-cordova-android) in such a way that it will create the database in Android's Default location which is /data/data/package-name/databases/

By just this simple command

window.openDatabase("something", "1.0", "PhoneGap Demo", 0);

You will get your desired something.db in the above mentioned location..




回答2:


Easiest solution seems to be to create a shared preference plugin, should work well with small and simple data.



来源:https://stackoverflow.com/questions/9717988/access-localstorage-or-web-database-created-in-phonegap-from-android-native-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!