从网页的Andr​​oid访问共享preferences装载使用loadURL [英] Android access sharedpreferences from webpage loaded with loadURL

查看:224
本文介绍了从网页的Andr​​oid访问共享preferences装载使用loadURL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Andr​​oid应用程序与混合装载使用loadURL(网页与一些绘图选项的JavaScript动力学)的HTML部分本地部分(用户autentication和安全code检索)。

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).

在我的JavaScript的之一,我需要访问的数据检索外部服务器。这种外部访问需求autentication。我想本机部内的autentication期间使用存储在我的共享prefernences的autentication数据。

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.

有没有从我的JavaScript的内部访问HTML部分共享preFS的方式?

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

推荐答案

创建本地插件使用科尔多瓦。和访问它在JavaScript的HTML。

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

有关科尔多瓦外挂教程

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

有关科尔多瓦共享preferences
<一href=\"http://stackoverflow.com/questions/17000135/which-way-is-$p$pferred-to-store-my-android-application-settings-to-access-them-v\">Which方法是pferred来存储我的Andr​​oid应用程序设置通过的PhoneGap和java文件来访问它们$ P $

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

这篇关于从网页的Andr​​oid访问共享preferences装载使用loadURL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆