version:4.3

fix:安装应用时不清除桌面缓存,锁定状态改变时不恢复出厂设置
update:在获取sn没有刷写的状态时,获取IMEI作为别名
This commit is contained in:
2022-04-19 09:24:45 +08:00
parent 2339e1484d
commit 69a8934bd4
24 changed files with 514 additions and 263 deletions

View File

@@ -5,6 +5,7 @@ import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import androidx.multidex.MultiDexApplication;
@@ -60,21 +61,11 @@ public class BaseApplication extends MultiDexApplication {
@SuppressLint("StaticFieldLeak")
public static Context context;
@SuppressLint("StaticFieldLeak")
private static BaseApplication instance;
public static Context getAppContext() {
return context;
}
// 单例模式中获取唯一的ExitApplication实例
public static BaseApplication getInstance() {
if (null == instance) {
instance = new BaseApplication();
}
return instance;
}
@Override
public void onCreate() {
super.onCreate();
@@ -163,7 +154,11 @@ public class BaseApplication extends MultiDexApplication {
//token在设备卸载重装的时候有可能会变
Log.e("TPush", "注册成功设备token为" + data);
List<XGPushManager.AccountInfo> accountInfoList = new ArrayList<>();
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getSerial()));
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getSerial(getApplicationContext())));
if (Utils.NOSN.equalsIgnoreCase(Utils.getSerial())) {
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getIMEI(getAppContext(), 0)));
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getIMEI(getAppContext(), 1)));
}
XGPushManager.upsertAccounts(getAppContext(), accountInfoList, new XGIOperateCallback() {
@Override
public void onSuccess(Object data, int flag) {
@@ -396,7 +391,7 @@ public class BaseApplication extends MultiDexApplication {
//https://docs.jiguang.cn/jpush/server/push/rest_api_v3_device/#_5
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(UrlAddress.DELETE_JPUSH_ALIAS + Utils.getSerial())
.url(UrlAddress.DELETE_JPUSH_ALIAS + Utils.getSerial(getAppContext()))
.header("Authorization", JGYUtils.getAuthorization())
.delete()
.build();
@@ -418,7 +413,7 @@ public class BaseApplication extends MultiDexApplication {
synchronized public static void cleanJpushTag() {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(UrlAddress.DELETE_JPUSH_TAG + Utils.getSerial())
.url(UrlAddress.DELETE_JPUSH_TAG + Utils.getSerial(getAppContext()))
.header("Authorization", JGYUtils.getAuthorization())
.delete()
.build();
@@ -437,16 +432,6 @@ public class BaseApplication extends MultiDexApplication {
});
}
private boolean finished = false;
public boolean isFinished() {
return finished;
}
public void setFinished(boolean b) {
this.finished = b;
}
public static void sendAppUsedTime(String random, String type) {
StatisticsInfo statisticsInfo = null;
if (type.equals("0")) {
@@ -491,7 +476,7 @@ public class BaseApplication extends MultiDexApplication {
NetInterfaceManager.getInstance()
.getAppLogApi()
.getAppLog(Utils.getSerial(), random, data.toJSONString())
.getAppLog(Utils.getSerial(getAppContext()), random, data.toJSONString())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BaseResponse>() {