从网络视图中接收来自第三方的发帖数据 [英] Receive post data from a 3rd party within a webview

查看:108
本文介绍了从网络视图中接收来自第三方的发帖数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

坚持http帖子数据的问题.

因此,我们创建了一个可使用的Web视图.

然后将其称为第三方Web服务,要求它提供回发URL和一些参数,然后,该Web服务处理参数并将用户(我们的应用程序)重定向到我们提供的回发URL,并将某些数据作为http发布. /p>

我们想从该回发URL中但在Web视图中或在我们的应用程序中获取发布数据.

尝试使用以下代码拦截URL加载:

   final WebView webview = new WebView(this);
   webview.setWebViewClient(new WebViewClient() {
   @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            // Grab data here...
            return super.shouldOverrideUrlLoading(view, url);
        }
    }); 

但是似乎找不到任何对象或方法来访问此方法中的数据.

另一种尝试是为他们提供回发网址,作为我们应用程序中的一种意图,例如:

   myscheme://someText/someParam

这会在调用回发时启动一个新活动(因为我们在android-manifest中设置了一个intent过滤器),此意图会在浏览器中触发我们的应用活动,但不会在我们的webview中触发,但无论如何再次,我们看不到如何从中访问帖子数据.

感谢您的关注,

有什么想法吗?

解决方案

找不到解决方法.基本上无法获得在Webview或浏览器意图上发布的数据.

相反,我们采用的解决方案是:

回发到服务器,在此处获取Postdata(PHP)并保存在数据库中,然后在手机中从该DB中检索数据.

Stuck on an issue with http post data.

So we've created a webview to work in.

Then called a third party webservice this ask's to provide a postback url and some parameters, the webservice then processes the paramaters and redirects the user (our app) to the postback url we provided, with some data as a http post.

We want to get the post data from this postback url but within the webview or within our app.

Tried intercepting the url load with this code:

   final WebView webview = new WebView(this);
   webview.setWebViewClient(new WebViewClient() {
   @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            // Grab data here...
            return super.shouldOverrideUrlLoading(view, url);
        }
    }); 

However can't seem to find any objects or methods to gain access to the data within this method.

The other attempt was to give them the postback url as an intent within our app like:

   myscheme://someText/someParam

this would have started a new activity when the postback is called (as we have set up an intent-filter within our android-manifest), this intent fires up our app activity within a browser but not within our webview, but anyway again we can't see how to access the post data from this.

Thanks for looking,

Any ideas?

解决方案

Didn't find a way to do this. Basically can't get at data posted at a webview or a browser intent.

Instead the solution we went with is:

Postback to a server, get the postdata here (PHP) and save in a DB, then retrieve the data from this DB within the phone.

这篇关于从网络视图中接收来自第三方的发帖数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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