update:2020.05.28
fix:去掉应用安装权限申请 add:升级apk覆盖安装推送和接口
This commit is contained in:
@@ -10,6 +10,7 @@ import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.support.multidex.MultiDexApplication;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -46,6 +47,7 @@ import org.lzh.framework.updatepluginlib.model.CheckEntity;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -490,6 +492,74 @@ public class MyApplication extends MultiDexApplication {
|
||||
|
||||
}
|
||||
|
||||
private static long totalTime;
|
||||
private static int totalTimes;
|
||||
|
||||
synchronized public static void setAPPUsage() {
|
||||
StatisticsInfo statisticsInfo = new StatisticsInfo(getAppContext());
|
||||
totalTime = statisticsInfo.getTotalTime();//全部时间
|
||||
totalTimes = statisticsInfo.getTotalTimes();//全部次数
|
||||
}
|
||||
|
||||
|
||||
synchronized public static void setAPPUsage(List<String> lists) {
|
||||
StatisticsInfo statisticsInfo = new StatisticsInfo(getAppContext());
|
||||
List<AppInformation> list = null;
|
||||
List<AppInformation> localAppList = new ArrayList<>();
|
||||
|
||||
totalTime = statisticsInfo.getTotalTime();//全部时间
|
||||
totalTimes = statisticsInfo.getTotalTimes();//全部次数
|
||||
|
||||
list = statisticsInfo.getShowList();
|
||||
if (list != null && list.size() > 0) {
|
||||
for (AppInformation appInformation : list) {
|
||||
if (lists.indexOf(appInformation.getPackageName()) != -1) {
|
||||
localAppList.add(appInformation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
synchronized public void getWhitePackageList() {
|
||||
OkGo.post(Configure.SEND_APP_USAGE)
|
||||
.params("sn", Utils.getSerial())
|
||||
.params("key", Configure.HTTP_KEY)
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, Response response) {
|
||||
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(s);
|
||||
int code = jsonObject.getInteger("code");
|
||||
String msg = jsonObject.getString("msg");
|
||||
String data = jsonObject.getString("data");
|
||||
if (code == 200) {
|
||||
com.alibaba.fastjson.JSONObject resultJson = JSON.parseObject(data);
|
||||
String result = resultJson.getString("result");
|
||||
if (!TextUtils.isEmpty(result)) {
|
||||
String[] list = result.split(",");
|
||||
List<String> allList = new ArrayList<>(Arrays.asList(list));
|
||||
setAPPUsage(allList);
|
||||
}
|
||||
} else {
|
||||
setAPPUsage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Call call, Response response, Exception e) {
|
||||
super.onError(call, response, e);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void catchException() {
|
||||
Thread.setDefaultUncaughtExceptionHandler(
|
||||
new Thread.UncaughtExceptionHandler() {
|
||||
|
||||
Reference in New Issue
Block a user