开发者

Receive post data from a 3rd party within a webview

开发者 https://www.devze.com 2023-02-09 23:12 出处:网络
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 pro

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.

0

精彩评论

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