Detailed explanation of WebView positioning in Android

preface

Now many apps have built-in web pages (hyprid APP), such as many e-commerce platforms, such as Taobao, JD, jucost, etc

JD home page

So how can this be achieved? In fact, this is implemented by a component called WebView in Android.

Recently doing Android web development. A page needs positioning, but the positioning acquisition fails all the time. I'm sorry. There are many online tutorials, but without exception, they all fail. Finally, I spent three days and worked hard to develop a solution.

Three step strategy:

1、 Get permission

After Android 6.0, you need to dynamically obtain location or storage permissions and place locations according to your preferences. When the application is initialized, I put it in the oncreate method in mainactivity.

2、 WebView setting setting (copied other people's code)

III. network authority

This is the end of the online tutorial. I usually tell you that your friend can use your positioning. But I can't use it!!!

Check, check. There's nothing wrong. As like as two peas!

IV. build gradle (I use as) modification

There is a targetsdkversion 23 in the build.gradle of your app (why did you write 23 Gaode map to tell me)

Then your engineering map will work.

Reference website: http://blog.csdn.net/cheunjq/article/details/54729875

summary

The above is the whole content of this article. I hope the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>