wuhb 2 lat temu
rodzic
commit
46bcf679ab

+ 2 - 2
app/build.gradle

@@ -9,8 +9,8 @@ android {
         applicationId "com.rms.agv"
         minSdk 27
         targetSdk 31
-        versionCode 9
-        versionName "1.1.9"
+        versionCode 8
+        versionName "1.1.8"
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     }

+ 2 - 2
app/release/output-metadata.json

@@ -11,8 +11,8 @@
       "type": "SINGLE",
       "filters": [],
       "attributes": [],
-      "versionCode": 6,
-      "versionName": "1.1.6",
+      "versionCode": 8,
+      "versionName": "1.1.8",
       "outputFile": "app-release.apk"
     }
   ],

+ 1 - 0
app/src/main/AndroidManifest.xml

@@ -46,6 +46,7 @@
         android:icon="@mipmap/logo"
         android:label="@string/app_name"
         android:usesCleartextTraffic="true"
+        android:requestLegacyExternalStorage="true"
         android:networkSecurityConfig="@xml/network_security_config"
         android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"

+ 2 - 2
app/src/main/java/com/qy/agv/activity/MainActivity.java

@@ -102,7 +102,7 @@ public class MainActivity extends BaseActivity {
         binding = ActivityMainBinding.inflate(getLayoutInflater());
         setContentView(binding.getRoot());
         context = this;
-        ProjectUtils.init();
+        ProjectUtils.init(this);
         registerReceiver();
         initCommonTop2();
         initLogin();
@@ -817,7 +817,7 @@ public class MainActivity extends BaseActivity {
     public void update(){
         UpdateManager updateManager = new UpdateManager(context);
         try {
-            updateManager.checkUpdate();
+            updateManager.checkUpdate(context);
         }catch (Exception ex){
             ex.printStackTrace();
             mylog.error("更新检测异常", ex);

+ 1 - 1
app/src/main/java/com/qy/agv/activity/RobotInfoActivity.java

@@ -84,7 +84,7 @@ public class RobotInfoActivity extends BaseActivity {
             e.printStackTrace();
         }
         if(isUpdate()) {
-            ProjectUtils.init();
+            ProjectUtils.init(this);
             UpdateManager updateManager = new UpdateManager(context, mHashMap);
             updateManager.showDownloadDialog();
         }else {

+ 2 - 2
app/src/main/java/com/qy/agv/update/UpdateManager.java

@@ -141,12 +141,12 @@ public class UpdateManager {
 	 * @throws NotFoundException
 	 */
 //	@RequiresApi(api = Build.VERSION_CODES.O)
-	public void checkUpdate() throws Exception {
+	public void checkUpdate(Context context) throws Exception {
 		if (isUpdate()) {
 			if(!StringUtils.isEmpty(next_version)){
 				ToastUtils.showToastL(mContext, "更新到版本"+next_version);
 			}
-			ProjectUtils.init();
+			ProjectUtils.init(context);
 			showDownloadDialog();
 //			downloadApk();
 		}

+ 8 - 4
app/src/main/java/com/qy/agv/util/ProjectUtils.java

@@ -1,5 +1,6 @@
 package com.qy.agv.util;
 
+import android.content.Context;
 import android.os.Environment;
 
 import java.io.File;
@@ -22,7 +23,7 @@ public class ProjectUtils {
     /**
      * 项目路径
      */
-    public static final String PROJECT_PATH = ROOT_DIRECTORY.getAbsolutePath() + "/"+Constant.PROJECT_NAME+"/";
+    public static String PROJECT_PATH = ROOT_DIRECTORY.getAbsolutePath() + "/"+Constant.PROJECT_NAME+"/";
 
     /**
      * 缓存
@@ -32,7 +33,7 @@ public class ProjectUtils {
     /**
      * 图片
      */
-    public static final String IMG = PROJECT_PATH + "IMG/";
+    public static String IMG = PROJECT_PATH + "IMG/";
 
     /**
      * Log
@@ -42,7 +43,7 @@ public class ProjectUtils {
     /**
      * Apk下载路径
      */
-    public static final String APK = PROJECT_PATH + "APK/";
+    public static String APK = PROJECT_PATH + "APK/";
 
     /**
      * 创建文件
@@ -75,13 +76,16 @@ public class ProjectUtils {
      *
      * @return If true is returned to the initial success, otherwise false
      */
-    public static boolean init() {
+    public static boolean init(Context context) {
+        PROJECT_PATH = context.getExternalFilesDir(null) + "/"+Constant.PROJECT_NAME+"/";
         boolean result = false;
         result &= createFolder(PROJECT_PATH) != null;
 //        result &= createFolder(CACHE) != null;
         result &= createFolder(IMG) != null;
 //        result &= createFolder(LOG) != null;
         result &= createFolder(APK) != null;
+        APK = PROJECT_PATH + "APK/";
+        IMG = PROJECT_PATH + "IMG/";
         return result;
     }
 

+ 1 - 1
app/src/main/res/xml/file_paths.xml

@@ -2,7 +2,7 @@
 <resources>
     <paths>
         <external-path name="download" path="." />
-        <external-path name="image" path="/qyagv/IMG/" />
+        <external-path name="image" path="/byjr/IMG/" />
     </paths>
 
 </resources>