开发者

Local android service receive data from local web page

I have offline web page on android tablet.

Is it possible to write android service which will get data from web page when user insert data and submit it, and when android service receive data than i开发者_如何学编程t has to save it in text file or db.

Everything is in offline local mode.


You should be carful when using the word Service besides android. People might get a worng idea of what you're taliking about because it has a special meaning for android.

Because a local webpage will submit a post request to a certain URL and your device is actually not the webserver you will fail with that. But you can accomplish your task with a javascript/JSON bridge to your local HTML. See this post to see how.

The idea is to use a click handler which collects the needed data and returns it to the webview by the javascript bridge instead submiting the data to a from submit URL. From java side to WebView you can respond with an JSON object.

To accomplish this you need to have fundamental knowledge about HTML and javascript and understand the use of a WebView.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜