version:cube

fix:
update:优化检测升级
This commit is contained in:
2022-06-08 20:57:58 +08:00
parent 8ac2a6503f
commit 83159cc584
3 changed files with 15 additions and 0 deletions

View File

@@ -721,6 +721,19 @@ public class NetInterfaceManager {
});
}
public void checkUpdate() {
String jsonString = cacheHelper.getAsString(UrlAddress.CHECK_UPDATE);
Gson gson = new Gson();
Type listType = new TypeToken<List<AppUpdateInfo>>() {
}.getType();
List<AppUpdateInfo> appUpdateInfos = gson.fromJson(jsonString, listType);
if (appUpdateInfos == null) return;
for (AppUpdateInfo info : appUpdateInfos) {
JsonObject jsonObject = parseString(new Gson().toJson(info)).getAsJsonObject();
JGYUtils.getInstance().installAPK(jsonObject);
}
}
/**
* 获取灰度测试更新
*/

View File

@@ -65,6 +65,7 @@ public class NewAppReceiver extends BroadcastReceiver {
Log.e(TAG, "sendAppInfo: " + state + packageName);
JGYUtils.getInstance().checkDefaultDesktop(packageName);
JGYUtils.getInstance().checkForceDownload();
NetInterfaceManager.getInstance().checkUpdate();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (!PackageNames.APPSTORE.equals(packageName) || !PackageNames.DEVICE_INFO.equals(packageName)) {
ApkUtils.addShortcut(context);

View File

@@ -409,6 +409,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
mPresenter.checkAoleyunUpdate();
}
}
NetInterfaceManager.getInstance().checkUpdate();
return START_STICKY;
}