Android- Webview onPageFinished Called Twice

后端 未结 7 984
名媛妹妹
名媛妹妹 2020-12-05 14:08

I have an activity that does OAuth authentication by intercepting the redirect url once it show up in the webview. However, the onPageFinished function is somehow called twi

7条回答
  •  無奈伤痛
    2020-12-05 14:31

    Android for some reason calls onPageFinished() twice(and onPageStarted() three times!) when the loaded url is not a working one. The temporary solution is changing the redirect_uri to the url of a working website; in this case, I changed it to https://www.google.com/ (lol, sorry Google). onPageFinished is then only called once.

    BUT- I do still want answers on why webview behaves differently when the loaded url is not a working one, and what is a better solution than changing the redirect_uri to google.com.

提交回复
热议问题