Android access sharedpreferences from webpage loaded with loadURL

∥☆過路亽.° 提交于 2019-12-14 03:17:52

问题


My Android app mixes a native part (user autentication and secure code retrieval) with an HTML part loaded with loadURL (webpage with javascript Kinetics for some drawing options).

Inside one of my javascripts I need to access an external server for data retrieval. This external access needs autentication. I want to use the autentication data stored in my SharedPrefernences during the autentication inside the native part.

Is there a way to access shared prefs from inside my javascripts in the HTML part?


回答1:


create native plug-in using cordova. and access it in javascript HTML.

http://cordova.apache.org/docs/en/2.5.0/guide_getting-started_android_index.md.html

for cordova plug-in tutorial

http://devgirl.org/2013/07/17/tutorial-how-to-write-a-phonegap-plugin-for-android/

for cordova SharedPreferences Which way is preferred to store my android application settings to access them via phonegap and java file



来源:https://stackoverflow.com/questions/20701222/android-access-sharedpreferences-from-webpage-loaded-with-loadurl

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