Commit 5e1b379f authored by p x's avatar p x
Browse files

炮筒

parent 4e1a44cb
...@@ -10,6 +10,9 @@ import android.view.KeyEvent ...@@ -10,6 +10,9 @@ import android.view.KeyEvent
import android.webkit.ConsoleMessage import android.webkit.ConsoleMessage
import android.webkit.SslErrorHandler import android.webkit.SslErrorHandler
import android.webkit.WebChromeClient import android.webkit.WebChromeClient
import android.webkit.WebResourceError
import android.webkit.WebResourceRequest
import android.webkit.WebResourceResponse
import android.webkit.WebSettings import android.webkit.WebSettings
import android.webkit.WebView import android.webkit.WebView
import android.webkit.WebViewClient import android.webkit.WebViewClient
...@@ -50,9 +53,9 @@ class MainActivity : AppCompatActivity() { ...@@ -50,9 +53,9 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
// enableEdgeToEdge() // enableEdgeToEdge()
binding = ActivityMainBinding.inflate(layoutInflater) binding = ActivityMainBinding.inflate(layoutInflater)
AMapLocationClient.updatePrivacyShow(this,true,true) // AMapLocationClient.updatePrivacyShow(this,true,true)
AMapLocationClient.updatePrivacyAgree(this,true) // AMapLocationClient.updatePrivacyAgree(this,true)
aMapLoc.initLocation() // aMapLoc.initLocation()
CustomLog.clearLog() CustomLog.clearLog()
setContentView(binding.root) setContentView(binding.root)
requestPers() requestPers()
...@@ -163,8 +166,10 @@ class MainActivity : AppCompatActivity() { ...@@ -163,8 +166,10 @@ class MainActivity : AppCompatActivity() {
setAllowUniversalAccessFromFileURLs(true) setAllowUniversalAccessFromFileURLs(true)
} }
// val url = "file:///android_asset/dist/index.html" // val url = "file:///android_asset/dist/index.html"
val url = "http://82.156.182.48:8088/3dmap/" // val url = "www.baidu.com"
// val url = "https://172.29.128.38:13443/shudao-navigation3d-app/index" // val url = "http://82.156.182.48:8088/3dmap/"
// val url = "https://10.149.230.104:19443/shudao-navigation3d-app/index"
val url = "https://172.29.128.38:13443/shudao-navigation3d-app/index"
binding.dwebview.loadUrl(url) binding.dwebview.loadUrl(url)
binding.dwebview.webViewClient = object : WebViewClient() { binding.dwebview.webViewClient = object : WebViewClient() {
...@@ -177,6 +182,22 @@ class MainActivity : AppCompatActivity() { ...@@ -177,6 +182,22 @@ class MainActivity : AppCompatActivity() {
// super.onReceivedSslError(view, handler, error) // super.onReceivedSslError(view, handler, error)
handler?.proceed() handler?.proceed()
} }
override fun onReceivedError(
view: WebView?,
request: WebResourceRequest?,
error: WebResourceError?
) {
super.onReceivedError(view, request, error)
}
override fun onReceivedHttpError(
view: WebView?,
request: WebResourceRequest?,
errorResponse: WebResourceResponse?
) {
super.onReceivedHttpError(view, request, errorResponse)
}
} }
binding.dwebview.webChromeClient = object : WebChromeClient() { binding.dwebview.webChromeClient = object : WebChromeClient() {
......
...@@ -60,7 +60,7 @@ class AMapLoc @Inject constructor(@ApplicationContext var context: Context) : Vi ...@@ -60,7 +60,7 @@ class AMapLoc @Inject constructor(@ApplicationContext var context: Context) : Vi
mOption.setLocationMode(AMapLocationMode.Hight_Accuracy) //可选,设置定位模式,可选的模式有高精度、仅设备、仅网络。默认为高精度模式 mOption.setLocationMode(AMapLocationMode.Hight_Accuracy) //可选,设置定位模式,可选的模式有高精度、仅设备、仅网络。默认为高精度模式
mOption.setGpsFirst(false) //可选,设置是否gps优先,只在高精度模式下有效。默认关闭 mOption.setGpsFirst(false) //可选,设置是否gps优先,只在高精度模式下有效。默认关闭
mOption.setHttpTimeOut(30000) //可选,设置网络请求超时时间。默认为30秒。在仅设备模式下无效 mOption.setHttpTimeOut(30000) //可选,设置网络请求超时时间。默认为30秒。在仅设备模式下无效
mOption.setInterval(1000) //可选,设置定位间隔。默认为2秒 mOption.setInterval(1000) //可选,设置定位间隔。默认为2秒 最快1秒,低于1秒还是1秒
mOption.setNeedAddress(false) //可选,设置是否返回逆地理地址信息。默认是true mOption.setNeedAddress(false) //可选,设置是否返回逆地理地址信息。默认是true
mOption.setOnceLocation(false) //可选,设置是否单次定位。默认是false mOption.setOnceLocation(false) //可选,设置是否单次定位。默认是false
mOption.setOnceLocationLatest(false) //可选,设置是否等待wifi刷新,默认为false.如果设置为true,会自动变为单次定位,持续定位时不要使用 mOption.setOnceLocationLatest(false) //可选,设置是否等待wifi刷新,默认为false.如果设置为true,会自动变为单次定位,持续定位时不要使用
...@@ -154,7 +154,7 @@ class AMapLoc @Inject constructor(@ApplicationContext var context: Context) : Vi ...@@ -154,7 +154,7 @@ class AMapLoc @Inject constructor(@ApplicationContext var context: Context) : Vi
//解析定位结果, //解析定位结果,
val result = sb.toString() val result = sb.toString()
CustomLog.d(TAG, result) // CustomLog.d(TAG, result)
setMyLocation(location,result) setMyLocation(location,result)
} else { } else {
CustomLog.d(TAG, "定位失败,loc is null") CustomLog.d(TAG, "定位失败,loc is null")
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
android:id="@+id/dwebview" android:id="@+id/dwebview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="gone"/> />
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<network-security-config> <network-security-config>
<base-config cleartextTrafficPermitted="true" /> <base-config cleartextTrafficPermitted="true" />
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">minedata.cn</domain>
<domain includeSubdomains="true">82.156.182.48</domain>
</domain-config>
</network-security-config> </network-security-config>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment