浏览代码

1.修改上传的设备信息。

2.修改拦截器默认数据
3.增加定位Log日志
20241218TB223FC(测试jar包)
wangwanlei 9 个月前
父节点
当前提交
859129ee45

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

@@ -29,6 +29,10 @@
29 29
     <!--位置权限-->
30 30
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
31 31
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
32
+    <!--后台获取位置信息,若需后台定位则必选-->
33
+    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
34
+    <!--用于申请调用A-GPS模块,卫星定位加速-->
35
+    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
32 36
     <!--护眼模式权限,只有系统app可以使用-->
33 37
     <uses-permission android:name="android.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS"
34 38
         tools:ignore="ProtectedPermissions" />

+ 1
- 0
app/src/main/java/com/xhly/manageapp/ui/login/activity/LoginActivity.kt 查看文件

@@ -134,6 +134,7 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
134 134
         }
135 135
         data.doEvent = EventLog.ACCOUNTLOGINEVENT
136 136
         viewModel.eventLog(data)
137
+        Const.USERID=userBean.userid.toString()
137 138
         spUtils.saveJson(Const.USERINFO,userBean)
138 139
         val parseClassToJson = GsonUtils.parseClassToJson(userBean)
139 140
         ZSpProvider.save(this,Const.USERINFO,parseClassToJson)

+ 1
- 1
app/src/main/java/com/xhly/manageapp/utils/PadInfoUtils.kt 查看文件

@@ -24,7 +24,7 @@ class PadInfoUtils {
24 24
             ManageApplication.getDeviceInfo()?.let {sn->
25 25
                 padInfoBean.sn=sn
26 26
             }
27
-            padInfoBean.deviceModel= Build.DEVICE
27
+            padInfoBean.deviceModel= Build.MODEL
28 28
             padInfoBean.deviceVersion=Build.VERSION.CODENAME
29 29
             padInfoBean.wifyMac=SystemUtil.getWifiMac(context)
30 30
             padInfoBean.blueMac=SystemUtil.getBluetoothMac()

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

@@ -67,9 +67,12 @@ class TimingWorker(context: Context, workerParams: WorkerParameters) :
67 67
                         padLocationBean.userid=it.userid
68 68
                     }
69 69
                     logService.postPadLocation(padLocationBean)
70
+                    LogShow("真没有位置")
71
+                }else{
72
+                    LogShow("没有位置")
70 73
                 }
71 74
             }catch (e:Exception){
72
-
75
+                LogShow("没有位置问题"+e.toString())
73 76
             }
74 77
         }
75 78
         return result

+ 2
- 1
corelib/src/main/java/com/xhly/corelib/Const.kt 查看文件

@@ -3,7 +3,8 @@ package com.xhly.corelib
3 3
 
4 4
 object Const {
5 5
     const val isDebug = true
6
-
6
+    //用户id
7
+     var USERID = "1"
7 8
     //接口地址
8 9
     const val URL1: String = "https://mcapitest.xhkjedu.com/"
9 10
 

+ 2
- 3
corelib/src/main/java/com/xhly/corelib/network/ResponseInterceptor.kt 查看文件

@@ -23,9 +23,8 @@ class ResponseInterceptor : Interceptor {
23 23
         return try {
24 24
             val requestBuilder: Request.Builder = request.newBuilder()
25 25
             //TODO 需要替换userid和机型
26
-            requestBuilder.header("XH-UserId","1")
27
-           /* requestBuilder.header("XH-DeviceModel", Build.MODEL)*/
28
-            requestBuilder.header("XH-DeviceModel", "CPN-W09")
26
+            requestBuilder.header("XH-UserId",Const.USERID)
27
+            requestBuilder.header("XH-DeviceModel", Build.MODEL)
29 28
             request = requestBuilder.build()
30 29
             val originalResponse = chain.proceed(request)
31 30
             val responseBody = originalResponse.body

+ 5
- 0
corelib/src/main/java/com/xhly/corelib/utils/SystemUtil.java 查看文件

@@ -292,6 +292,11 @@ public class SystemUtil {
292 292
                         data=lastKnownLocation;
293 293
                     }
294 294
                 }
295
+                if (data!=null){
296
+                    LogUtils.d("获得地理位置", "lat="+data.getLatitude()+",lon="+data.getLongitude() );
297
+                }else {
298
+                    LogUtils.d("获得地理位置", "没有位置");
299
+                }
295 300
                 return data;
296 301
             }
297 302
         } catch (Exception e) {

正在加载...
取消
保存