Browse Source

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

2.修改拦截器默认数据
3.增加定位Log日志
20241218TB223FC(测试jar包)
wangwanlei 9 months ago
parent
commit
859129ee45

+ 4
- 0
app/src/main/AndroidManifest.xml View File

29
     <!--位置权限-->
29
     <!--位置权限-->
30
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
30
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
31
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
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
     <!--护眼模式权限,只有系统app可以使用-->
36
     <!--护眼模式权限,只有系统app可以使用-->
33
     <uses-permission android:name="android.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS"
37
     <uses-permission android:name="android.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS"
34
         tools:ignore="ProtectedPermissions" />
38
         tools:ignore="ProtectedPermissions" />

+ 1
- 0
app/src/main/java/com/xhly/manageapp/ui/login/activity/LoginActivity.kt View File

134
         }
134
         }
135
         data.doEvent = EventLog.ACCOUNTLOGINEVENT
135
         data.doEvent = EventLog.ACCOUNTLOGINEVENT
136
         viewModel.eventLog(data)
136
         viewModel.eventLog(data)
137
+        Const.USERID=userBean.userid.toString()
137
         spUtils.saveJson(Const.USERINFO,userBean)
138
         spUtils.saveJson(Const.USERINFO,userBean)
138
         val parseClassToJson = GsonUtils.parseClassToJson(userBean)
139
         val parseClassToJson = GsonUtils.parseClassToJson(userBean)
139
         ZSpProvider.save(this,Const.USERINFO,parseClassToJson)
140
         ZSpProvider.save(this,Const.USERINFO,parseClassToJson)

+ 1
- 1
app/src/main/java/com/xhly/manageapp/utils/PadInfoUtils.kt View File

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

+ 4
- 1
app/src/main/java/com/xhly/manageapp/workmanager/TimingWorker.kt View File

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

+ 2
- 1
corelib/src/main/java/com/xhly/corelib/Const.kt View File

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

+ 2
- 3
corelib/src/main/java/com/xhly/corelib/network/ResponseInterceptor.kt View File

23
         return try {
23
         return try {
24
             val requestBuilder: Request.Builder = request.newBuilder()
24
             val requestBuilder: Request.Builder = request.newBuilder()
25
             //TODO 需要替换userid和机型
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
             request = requestBuilder.build()
28
             request = requestBuilder.build()
30
             val originalResponse = chain.proceed(request)
29
             val originalResponse = chain.proceed(request)
31
             val responseBody = originalResponse.body
30
             val responseBody = originalResponse.body

+ 5
- 0
corelib/src/main/java/com/xhly/corelib/utils/SystemUtil.java View File

292
                         data=lastKnownLocation;
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
                 return data;
300
                 return data;
296
             }
301
             }
297
         } catch (Exception e) {
302
         } catch (Exception e) {

Loading…
Cancel
Save