Reputation: 605
I have an android application which will open a react js application in a web view. The android app will post JSON data to its web view which will render my react js application. However, I am not sure how I would fetch the data from a post to the Android web view from my react js application. I tried posting some JSON data to my react js application using POSTMAN which returns a 404 page not found. The android application will use something similar to the below code to post to the webview:-
WebView webview = new WebView(this);
setContentView(webview);
String url = "http://www.example.com";
String postData = "username=" + URLEncoder.encode(my_username, "UTF-8") + "&password=" + URLEncoder.encode(my_password, "UTF-8");
webview.postUrl(url,postData.getBytes());
Please find attached a copy of the screenshot for my POSTMAN post request.
Any help or suggestion is appreciated. Thank you.
Upvotes: 1
Views: 1447