Solution to the problem of unable to locate in Android WebView
I had a problem before. I couldn't locate it when I used WebView. Recently, the top 19 can't find a wall. I can only go to Baidu. I found that someone said they wanted to do so
Many places on the Internet say that you can locate normally after adding this code, but I still have no egg use after adding it. No way, Baidu is awesome without Google. After reading the log, I said that I didn't get permission, but the callback. Invoke (origin, true) in the code; It is an operation to obtain location permission.
After thinking for a while, I suddenly thought of dynamically applying for permission after 6.0.
In this way, I add the code of dynamic application permission
It is found that you can normally obtain the positioning results. Some people may not know where to apply dynamically. In fact, it depends on your specific process. You can also apply when you jump to this page or when you display the web page.
Finally, the ongelocationpermissionsshowprompt method will only be called once. Like the dynamic application for permission, it will only be called for the first time.
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.