0

I will try to be as brief and concise as possible. I have been trying to tackle this problem for last 5 days. Please help me get out of this.

-> I have a WordPress website, on which I have installed a plugin called Digit.

-> This plugin let the users to register themselves on my website using their phone number.

-> A verification code gets sent on the user's mobile and after entering the right pin, the user gets redirected to the dashboard successfully.

Let me just explain a visual scenario, briefly:

  1. User enters its number.

  2. After clicking on "Send OTP" button, a small browser window pops up, which takes the user to the 3rd party website and from where user enters and fill its verification code.

  3. After verification, the tab gets closed automatically and user gets redirected to the dashboard successfully.

On Browsers, it is working fine. No problem at all

Now the actual problem starts here:

-> I have created a webview based android app.

-> The app is working, pretty fine. Everything is working like normal.

-> But when user tries to Signup and enter its number and click on "Send OTP", the small popup window opens and asks the user to fill the OTP received.

-> After entering the OTP, it gets Successfully Verified, but it does not get closed and redirect the user to the dashboard page, where it is supposed to be.

-> There is nothing written on the screen, just written the "Success message".

Below is the app image after verification

enter image description here

Below is my "MainActivity.java fiel link: https://drive.google.com/open?id=1YnNPtDkP3V58FY2fQU2MIuTCKSHm9_l8

  • Check this answer https://stackoverflow.com/a/4066497/1876355 so you should "check" whether it was successful or not and close the WebView. There are ways to get the content from the webview. – Pierre Jan 08 '19 at 09:48
  • Thanks for responding Pierre. Actually my redirection is already opening in the app. The things is, after verifying my number, the window does not close and redirect the user to the dashboard page. – himaavar mt Jan 08 '19 at 09:58
  • I also tried adding this code in my MainActivity.java file but not working:- webview.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url){ // do your handling codes here, which url is the requested url // probably you need to open that url rather than redirect: view.loadUrl(url); return false; // then it is not handled by default action } }); – himaavar mt Jan 08 '19 at 09:58
  • The WebView itself won't close - you have to do it programatically. That is why you need to "Monitor" the content manually and when you are satisfied, close the WebView – Pierre Jan 08 '19 at 10:28
  • Can you give me any source, where I can find the solution for this. I have tried everything from the link you posted above but no solution. – himaavar mt Jan 08 '19 at 11:39
  • You can't "close" a WebView. What you could do is hide it by using webView.setVisibility(View.INVISIBLE); Otherwise you need to create separate activity for web view and after your work done, you can close activity by using finish(); – VikaS GuttE Jan 12 '19 at 07:48
  • Thanks for replying Vikas. I want to make it clear that on browsers, everything is working fine. The popup window closes automatically after verification and redirects the user to its dashboard with successfully logging in. the actual problem is that in the WebView the user is not getting redirected after verification know the popup window is getting closed only the verification sign is there. that's it. – himaavar mt Jan 12 '19 at 08:10
  • @himaavarmt Check this Question https://stackoverflow.com/questions/8200945/how-to-get-html-content-from-a-webview It will possibly give you a "Solution" on how to get the HTML content. If this won't help you, You will need to check and see if you can find a direct API for `Digit` to login users, etc. Or you could write your own Webservice on your server, manage the html content ie. Return an OTP to the app, user enters it, back to your web service, verify it, and return a proper response to the app again. – Pierre Jan 14 '19 at 05:02

0 Answers0