瀏覽代碼

1.添加百度地图定位。

20241218TB223FC(测试jar包)
wangwanlei 11 月之前
父節點
當前提交
2b4a1e470b

+ 4
- 0
app/build.gradle.kts 查看文件

24
         vectorDrawables {
24
         vectorDrawables {
25
             useSupportLibrary = true
25
             useSupportLibrary = true
26
         }
26
         }
27
+        ndk{
28
+            abiFilters += listOf("armeabi","armeabi-v7a","arm64-v8a","x86","x86_64")
29
+        }
27
     }
30
     }
28
     viewBinding{
31
     viewBinding{
29
         enable=true
32
         enable=true
118
     implementation(project(mapOf("path" to ":websocket")))
121
     implementation(project(mapOf("path" to ":websocket")))
119
     implementation(libs.androidx.cardview)
122
     implementation(libs.androidx.cardview)
120
     testImplementation(libs.junit)
123
     testImplementation(libs.junit)
124
+    implementation("com.baidu.lbsyun:BaiduMapSDK_Location_All:9.3.7")
121
     androidTestImplementation(libs.androidx.test.ext.junit)
125
     androidTestImplementation(libs.androidx.test.ext.junit)
122
     androidTestImplementation(libs.espresso.core)
126
     androidTestImplementation(libs.espresso.core)
123
     androidTestImplementation(platform(libs.compose.bom))
127
     androidTestImplementation(platform(libs.compose.bom))

二進制
app/libs/arm64-v8a/libindoor.so 查看文件


二進制
app/libs/arm64-v8a/liblocSDK8b.so 查看文件


二進制
app/libs/armeabi-v7a/libindoor.so 查看文件


二進制
app/libs/armeabi-v7a/liblocSDK8b.so 查看文件


+ 5
- 0
app/src/main/AndroidManifest.xml 查看文件

59
         <meta-data
59
         <meta-data
60
             android:name="design_height_in_dp"
60
             android:name="design_height_in_dp"
61
             android:value="667" /> <!-- 全局内容提供者 -->
61
             android:value="667" /> <!-- 全局内容提供者 -->
62
+        <meta-data
63
+            android:name="com.baidu.lbsapi.API_KEY"
64
+            android:value="9eZF1Cg9JYIzme7dSnG8rmeUj7ET3lK1" >
65
+        </meta-data>
66
+        <service android:name="com.baidu.location.f" android:enabled="true" android:process=":remote"> </service>
62
         <activity
67
         <activity
63
             android:name="com.xhly.manageapp.ui.main.activity.MainActivity"
68
             android:name="com.xhly.manageapp.ui.main.activity.MainActivity"
64
             android:exported="true"
69
             android:exported="true"

+ 9
- 0
app/src/main/java/com/xhly/manageapp/bean/PadLocationConst.kt 查看文件

1
+package com.xhly.manageapp.bean
2
+
3
+import com.xhly.manageapp.bean.log.PadLocationBean
4
+
5
+//存储地理位置,用来上传数据
6
+object PadLocationConst {
7
+    val currentLocation=PadLocationBean()
8
+    val lastLocation=PadLocationBean()
9
+}

+ 7
- 2
app/src/main/java/com/xhly/manageapp/bean/log/PadLocationBean.kt 查看文件

7
     /**
7
     /**
8
      * 经度
8
      * 经度
9
      */
9
      */
10
-    var lon:Double = 0.0
10
+    var lon:Double? = null
11
 
11
 
12
     /**
12
     /**
13
      * 维度
13
      * 维度
14
      */
14
      */
15
-    var lat:Double = 0.0
15
+    var lat:Double? =null
16
 
16
 
17
     /**
17
     /**
18
      * 用户id
18
      * 用户id
23
      * 设备sn
23
      * 设备sn
24
      */
24
      */
25
     var sn = ""
25
     var sn = ""
26
+
27
+    /**
28
+     * address
29
+     */
30
+    var address:String?=null
26
 }
31
 }

+ 11
- 0
app/src/main/java/com/xhly/manageapp/ui/main/viewmodel/MainViewModel.kt 查看文件

12
 import com.xhly.manageapp.bean.WallpaperBean
12
 import com.xhly.manageapp.bean.WallpaperBean
13
 import com.xhly.manageapp.bean.app.AppInstallBean
13
 import com.xhly.manageapp.bean.app.AppInstallBean
14
 import com.xhly.manageapp.bean.log.PadInfoBean
14
 import com.xhly.manageapp.bean.log.PadInfoBean
15
+import com.xhly.manageapp.bean.log.PadLocationBean
15
 import com.xhly.manageapp.bean.school.SchoolDeviceSetBean
16
 import com.xhly.manageapp.bean.school.SchoolDeviceSetBean
16
 import com.xhly.manageapp.bean.strategy.AppTimeManageBean
17
 import com.xhly.manageapp.bean.strategy.AppTimeManageBean
17
 import com.xhly.manageapp.bean.strategy.StrategyBean
18
 import com.xhly.manageapp.bean.strategy.StrategyBean
250
             }
251
             }
251
         }
252
         }
252
     }
253
     }
254
+
255
+    /**
256
+     * 发送定位
257
+     */
258
+
259
+    fun  postPadLocation(location:PadLocationBean){
260
+        launchUI {
261
+            logService.postPadLocation(location)
262
+        }
263
+    }
253
 }
264
 }

+ 11
- 8
app/src/main/java/com/xhly/manageapp/workmanager/TimingWorker.kt 查看文件

15
 import com.xhly.corelib.utils.SystemUtil
15
 import com.xhly.corelib.utils.SystemUtil
16
 import com.xhly.corelib.utils.toFormat
16
 import com.xhly.corelib.utils.toFormat
17
 import com.xhly.manageapp.ManageApplication
17
 import com.xhly.manageapp.ManageApplication
18
+import com.xhly.manageapp.bean.PadLocationConst
18
 import com.xhly.manageapp.bean.log.LogAppStartBean
19
 import com.xhly.manageapp.bean.log.LogAppStartBean
19
 import com.xhly.manageapp.bean.log.PadLocationBean
20
 import com.xhly.manageapp.bean.log.PadLocationBean
20
 import com.xhly.manageapp.bean.user.UserBean
21
 import com.xhly.manageapp.bean.user.UserBean
59
             if (appInfo.size > 0) {
60
             if (appInfo.size > 0) {
60
                 logService.postLogAppStartAdd(appInfo)
61
                 logService.postLogAppStartAdd(appInfo)
61
             }
62
             }
63
+/*
62
             try {
64
             try {
63
-                val location = SystemUtil.getLocation(applicationContext)
64
-                if (location!=null){
65
-                    val padLocationBean=PadLocationBean()
66
-                    padLocationBean.lat=location.latitude
67
-                    padLocationBean.lon=location.longitude
65
+                val location = PadLocationConst.currentLocation
66
+                val lastLocation = PadLocationConst.lastLocation
67
+                if (location.lat!=null&&location.lon!=null&&(lastLocation.lon!=location.lon&&lastLocation.lat!=location.lat)){
68
+                    lastLocation.lat=location.lat
69
+                    lastLocation.lon=location.lon
68
                     ManageApplication.getDeviceInfo()?.let {
70
                     ManageApplication.getDeviceInfo()?.let {
69
-                        padLocationBean.sn=it
71
+                        location.sn=it
70
                     }
72
                     }
71
                     userBean?.let {
73
                     userBean?.let {
72
-                        padLocationBean.userid=it.userid
74
+                        location.userid=it.userid
73
                     }
75
                     }
74
-                    logService.postPadLocation(padLocationBean)
76
+                    logService.postPadLocation(location)
75
                     LogShow("真没有位置")
77
                     LogShow("真没有位置")
76
                 }else{
78
                 }else{
77
                     LogShow("没有位置")
79
                     LogShow("没有位置")
79
             }catch (e:Exception){
81
             }catch (e:Exception){
80
                 LogShow("没有位置问题"+e.toString())
82
                 LogShow("没有位置问题"+e.toString())
81
             }
83
             }
84
+*/
82
             //创建socket
85
             //创建socket
83
             userBean?.let {
86
             userBean?.let {
84
                 ManageApplication.instance?.let {
87
                 ManageApplication.instance?.let {

Loading…
取消
儲存