version:1.0
update:2021-10-13 18:52:13 fix:去除okgo,rxAndroid1,优化依赖 add:切换到奥乐云平台
This commit is contained in:
986
app/src/main/java/com/aoleyun/sn/receiver/MyJPushReceiver.java
Normal file
986
app/src/main/java/com/aoleyun/sn/receiver/MyJPushReceiver.java
Normal file
@@ -0,0 +1,986 @@
|
||||
package com.aoleyun.sn.receiver;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
import com.amap.api.location.AMapLocationListener;
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.blankj.utilcode.util.PathUtils;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.utils.CacheUtils;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.base.BaseApplication;
|
||||
import com.aoleyun.sn.comm.CommonDatas;
|
||||
import com.aoleyun.sn.manager.AmapManager;
|
||||
import com.aoleyun.sn.manager.NetInterfaceManager;
|
||||
import com.aoleyun.sn.network.HTTPInterface;
|
||||
import com.aoleyun.sn.service.MainService;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.CmdUtil;
|
||||
import com.aoleyun.sn.utils.ForegroundAppUtil;
|
||||
import com.aoleyun.sn.utils.Logutils;
|
||||
import com.aoleyun.sn.utils.MySQLData;
|
||||
import com.aoleyun.sn.utils.SPUtils;
|
||||
import com.aoleyun.sn.utils.SaveListUtils;
|
||||
import com.aoleyun.sn.utils.ServiceAliveUtils;
|
||||
import com.aoleyun.sn.utils.ToastUtil;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
public class MyJPushReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = MyJPushReceiver.class.getSimpleName();
|
||||
|
||||
//删除应用
|
||||
private final String MSG_DELETE = "1";
|
||||
//系统设置管控
|
||||
private final String MSG_SETTING = "2";
|
||||
//浏览器网址管控
|
||||
private final String MSG_BROWSER = "4";
|
||||
//app id管控
|
||||
private final String MSG_APPID = "5";
|
||||
//应用联网管控
|
||||
private final String MSG_NET_CONTROL = "6";
|
||||
//APP自启联网滑动管控
|
||||
private final String MSG_POWER_ON = "7";
|
||||
//重置
|
||||
private final String MSG_RESET = "8";
|
||||
//强制安装
|
||||
private final String MSG_INSTALL = "9";
|
||||
//解锁
|
||||
private final String MSG_LOCK = "10";
|
||||
//旧版相机管控
|
||||
private final String MSG_CAMERA = "11";
|
||||
|
||||
private final String MSG_ONEPACKAGES = "12";
|
||||
//app使用时间
|
||||
private final String GET_APP_USEDTIME = "13";
|
||||
//强制下载
|
||||
private final String GET_FORCEDOWNLOADURL = "14";
|
||||
//主页和书签管控
|
||||
private final String SET_HOMEPAG_TAG = "15";
|
||||
//app内网页管控
|
||||
private final String APP_WEBSITE = "16";
|
||||
//禁止app升级
|
||||
private final String DISABLE_APPUPDATE = "17";
|
||||
//隐藏桌面图标
|
||||
private final String HIDE_DESKTOP_ICON = "18";
|
||||
//禁止滑动
|
||||
private final String DISABLE_APP_SLIDE = "19";
|
||||
//更新引用白名单
|
||||
private final String UPDATE_INFO = "20";
|
||||
//截图
|
||||
private final String SN_SCREENSHOT = "21";
|
||||
//重启
|
||||
private final String DEVICES_REBOOT = "22";
|
||||
//获取设备详细信息
|
||||
private final String GET_DEVICES_INFO = "23";
|
||||
//霸屏
|
||||
private final String LOCK_SCREEN = "24";
|
||||
//取消霸屏
|
||||
private final String UNLOCK_SCREEN = "25";
|
||||
//结束进程
|
||||
private final String KILL_SERVER = "26";
|
||||
//时间管控
|
||||
private final String TIME_CONTROL = "27";
|
||||
//app霸屏
|
||||
private final String TOP_APP = "28";
|
||||
//开机动画
|
||||
private final String LOGO_IMG = "29";
|
||||
//默认应用
|
||||
private final String DEFAULTP_APP = "30";
|
||||
//发出声音
|
||||
private final String PLAY_SOUND = "31";
|
||||
//清除app数据
|
||||
private final String CLEAN_APP_CACHE = "32";
|
||||
//开发人员选项
|
||||
private final String DEVELOPER_OPTIONS = "33";
|
||||
//全局更新
|
||||
private final String GLOBAL_UPDATE = "34";
|
||||
//电子书包激活码
|
||||
private final String EBAG_CODE = "35";
|
||||
//更新白名单
|
||||
private final String UPDATE_WHITELIST = "36";
|
||||
//更换批次不恢复出厂
|
||||
private final String UPDATE_BATCH = "37";
|
||||
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private int changeNum(int paramInt) {
|
||||
return paramInt == 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
mContext = context;
|
||||
Bundle bundle = intent.getExtras();
|
||||
|
||||
if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
|
||||
String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
|
||||
Logutils.e(TAG, "[MyReceiver] 接收Registration Id : " + regId);
|
||||
//send the Registration Id to your server...
|
||||
} else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
|
||||
// ToastTool.show("[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE)
|
||||
// + "---" + bundle.getString(JPushInterface.EXTRA_TITLE) + "---" + bundle.getString(JPushInterface.EXTRA_CONTENT_TYPE)
|
||||
// + "---" + bundle.getString(JPushInterface.EXTRA_EXTRA) + "----" + bundle.getString("package_name"));
|
||||
// Logutils.e(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE)
|
||||
// + "---" + bundle.getString(JPushInterface.EXTRA_TITLE) + "---" + bundle.getString(JPushInterface.EXTRA_CONTENT_TYPE)
|
||||
// + "---" + bundle.getString(JPushInterface.EXTRA_EXTRA) + "----" + bundle.getString("package_name"));
|
||||
processCustomMessage(context, bundle);//屏蔽推送
|
||||
} else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
|
||||
Logutils.e(TAG, "[MyReceiver] 接收到推送下来的通知" + bundle.getString(JPushInterface.EXTRA_EXTRA));
|
||||
// doDownloadAndInstall(bundle.getString(JPushInterface.EXTRA_EXTRA));
|
||||
// Logutils.e(getBatteryLevel()+"-0-iweroiwerewefeerer-----------");
|
||||
int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
|
||||
Logutils.e(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
|
||||
} else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
|
||||
Logutils.e(TAG, "[MyReceiver] 用户点击打开了通知");
|
||||
} else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
|
||||
Logutils.e(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
|
||||
//在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码,比如打开新的Activity, 打开一个网页等..
|
||||
} else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
|
||||
boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
|
||||
Logutils.i(TAG, "[MyReceiver]" + intent.getAction() + " connected state change to " + connected);
|
||||
} else {
|
||||
Logutils.e(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
|
||||
}
|
||||
}
|
||||
|
||||
private void processCustomMessage(final Context context, Bundle bundle) {
|
||||
String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
|
||||
String title = bundle.getString(JPushInterface.EXTRA_TITLE);
|
||||
String type = bundle.getString(JPushInterface.EXTRA_CONTENT_TYPE);
|
||||
String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
|
||||
String package_name = bundle.getString("package_name");
|
||||
Logutils.e(TAG, "message::" + message + "--type::" + type + "--title::" + title + "--extras::" + extras);
|
||||
switch (message) {
|
||||
default:
|
||||
break;
|
||||
case MSG_DELETE:
|
||||
ToastUtil.betaShow("收到管控:应用删除");
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
if (SaveListUtils.getlist().contains(title)) {
|
||||
SaveListUtils.getlist().remove(title);
|
||||
}
|
||||
SaveListUtils.sendForceAPP(mContext);
|
||||
ApkUtils.UninstallAPP(mContext, title);
|
||||
}
|
||||
HTTPInterface.getAppLimit(context);
|
||||
HTTPInterface.getNetAndLaunchSetting(mContext);
|
||||
break;
|
||||
case MSG_SETTING:
|
||||
ToastUtil.betaShow("收到管控:系统设置");
|
||||
if (!TextUtils.isEmpty(extras)) {
|
||||
JGYUtils.getInstance().SettingSysData(extras);
|
||||
}
|
||||
break;
|
||||
case MSG_BROWSER:
|
||||
ToastUtil.betaShow("收到管控:浏览器网址管控");
|
||||
getDeselectBrowerID();
|
||||
break;
|
||||
case MSG_APPID:
|
||||
ToastUtil.betaShow("收到管控:APP ID管控");
|
||||
getDeselectID();
|
||||
break;
|
||||
case MSG_NET_CONTROL:
|
||||
ToastUtil.betaShow("收到管控:应用联网管控");
|
||||
settingNetControl(extras);
|
||||
break;
|
||||
case MSG_POWER_ON:
|
||||
ToastUtil.betaShow("收到管控:应用自启管控");
|
||||
settingPowerOn(extras);
|
||||
break;
|
||||
case MSG_RESET:
|
||||
ToastUtil.betaShow("收到管控:设备重置");
|
||||
Utils.doMasterClear(mContext);
|
||||
break;
|
||||
case MSG_INSTALL:
|
||||
ToastUtil.betaShow("收到管控:应用安装");
|
||||
HTTPInterface.getAppLimit(context);
|
||||
doDownloadAndInstall(extras);
|
||||
HTTPInterface.setHideDesktopIcon(mContext);
|
||||
break;
|
||||
case MSG_LOCK:
|
||||
ToastUtil.betaShow("收到管控:设备锁定");
|
||||
settingLock(extras);
|
||||
break;
|
||||
case MSG_CAMERA:
|
||||
ToastUtil.betaShow("收到管控:相机管控");
|
||||
settingCamera(extras);
|
||||
break;
|
||||
case MSG_ONEPACKAGES:
|
||||
ToastUtil.betaShow("收到管控:");
|
||||
if (BaseApplication.getInstance().isFinished()) {
|
||||
settingOneNet(extras);
|
||||
}
|
||||
break;
|
||||
case GET_APP_USEDTIME:
|
||||
ToastUtil.betaShow("收到管控:获取应用使用时间");
|
||||
JSONObject jsonObject = JSON.parseObject(extras);
|
||||
String random = jsonObject.getString("random");
|
||||
String sendType = jsonObject.getString("type");
|
||||
BaseApplication.sendAppUsedTime(random, sendType);
|
||||
break;
|
||||
case GET_FORCEDOWNLOADURL:
|
||||
ToastUtil.betaShow("收到管控:应用强制安装");
|
||||
File file = new File(PathUtils.getExternalDownloadsPath() + "/jgy/");
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
if (TextUtils.isEmpty(extras)) {
|
||||
Logutils.e(TAG, "settingNetControl extras is null");
|
||||
return;
|
||||
}
|
||||
JSONObject extra = JSON.parseObject(extras);
|
||||
String app_name = extra.getString("app_name");
|
||||
String app_package = extra.getString("package");
|
||||
String url = extra.getString("url");
|
||||
int versionCode = extra.getInteger("version_code");
|
||||
String app_id = extra.getString("app_id");
|
||||
JSONObject packageObj = new JSONObject();
|
||||
packageObj.put("app_name", app_name);
|
||||
packageObj.put("app_package", app_package);
|
||||
packageObj.put("app_id", app_id);
|
||||
// Aria.download(this)
|
||||
// .load(url) //读取下载地址
|
||||
// .setFilePath(PathUtils.getExternalDownloadsPath() + "/jgy/" + EncryptUtils.encryptMD5ToString(url) + ".apk", true)
|
||||
// .setExtendField(packageObj.toJSONString())
|
||||
// .create(); //启动下载}
|
||||
Utils.ariaDownload(mContext, url, packageObj);
|
||||
break;
|
||||
case SET_HOMEPAG_TAG:
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
new CacheUtils().cleanApplicationUserData(mContext, "com.android.browser");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Logutils.e(TAG, "setHomepagtag: " + e.getMessage());
|
||||
}
|
||||
setHomepagtag(extras);
|
||||
ToastUtil.betaShow("收到管控:浏览器主页书签设置");
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
break;
|
||||
case APP_WEBSITE:
|
||||
ToastUtil.betaShow("收到管控:APP内部网页管控");
|
||||
setAPPinsideWebsite(extras);
|
||||
break;
|
||||
case DISABLE_APPUPDATE:
|
||||
ToastUtil.betaShow("收到管控:应用禁止更新设置");
|
||||
setDisableUpdateList(extras);
|
||||
break;
|
||||
case HIDE_DESKTOP_ICON:
|
||||
ToastUtil.betaShow("收到管控:隐藏应用设置");
|
||||
Handler.getMain().postDelayed(() -> {
|
||||
//后台发送时数据库未改变,有时候可能获取到的数据时上一次的
|
||||
Logutils.e(TAG, "run: HIDE_DESKTOP_ICON ");
|
||||
HTTPInterface.setHideDesktopIcon(context);
|
||||
}, 2000);
|
||||
break;
|
||||
case DISABLE_APP_SLIDE:
|
||||
ToastUtil.betaShow("收到管控:应用滑动设置");
|
||||
setDisableSlideList(extras);
|
||||
break;
|
||||
case UPDATE_INFO:
|
||||
ToastUtil.betaShow("收到管控:更新白名单");
|
||||
HTTPInterface.getAppLimit(context);
|
||||
break;
|
||||
case SN_SCREENSHOT:
|
||||
ToastUtil.betaShow("收到管控:设备截图");
|
||||
screenshot(extras);
|
||||
break;
|
||||
case DEVICES_REBOOT:
|
||||
ToastUtil.betaShow("收到管控:设备重启");
|
||||
Utils.rebootDevices(mContext);
|
||||
break;
|
||||
case GET_DEVICES_INFO:
|
||||
ToastUtil.betaShow("收到管控:获取设备信息");
|
||||
if (MainService.mPresenter != null) {
|
||||
MainService.mPresenter.getLockedState();
|
||||
Logutils.e(TAG, "mPresenter: " + "getLockedState");
|
||||
} else {
|
||||
Logutils.e(TAG, "mPresenter is NULL");
|
||||
}
|
||||
AMapLocationClient aMapLocationClient = AmapManager.getInstance().getLocationClient();
|
||||
aMapLocationClient.stopLocation();
|
||||
aMapLocationClient.startLocation();
|
||||
aMapLocationClient.setLocationListener(new AMapLocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(AMapLocation aMapLocation) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
//errCode等于0代表定位成功,其他的为定位失败,具体的可以参照官网定位错误码说明
|
||||
if (aMapLocation.getErrorCode() == 0) {
|
||||
Logutils.e(TAG, "onLocationChanged: " + "定位成功");
|
||||
Logutils.e(TAG, "onLocationChanged: " + aMapLocation.getAddress());
|
||||
sb.append(aMapLocation.getAddress()).append("\n");
|
||||
SPUtils.put(mContext, "AmapAddress", aMapLocation.getAddress());
|
||||
SPUtils.put(mContext, "longitude", aMapLocation.getLongitude());
|
||||
SPUtils.put(mContext, "latitude", aMapLocation.getLatitude());
|
||||
} else {
|
||||
//定位失败
|
||||
sb.append("定位失败" + "\n");
|
||||
SPUtils.put(mContext, "AmapError", String.valueOf(aMapLocation.getErrorCode()));
|
||||
}
|
||||
Logutils.e(TAG, (String) SPUtils.get(mContext, "AmapAddress", "-"));
|
||||
Logutils.e(TAG, (String) SPUtils.get(mContext, "AmapError", "-"));
|
||||
Logutils.e(TAG, "amap: " + sb.toString());
|
||||
HTTPInterface.updateDeviceInfo(mContext);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case LOCK_SCREEN:
|
||||
ToastUtil.betaShow("收到管控:屏幕锁定");
|
||||
JSONObject lockJSONObject = JSON.parseObject(extras);
|
||||
String name = lockJSONObject.getString("name");
|
||||
setLock_screen(1, context, name);
|
||||
break;
|
||||
case UNLOCK_SCREEN:
|
||||
ToastUtil.betaShow("收到管控:屏幕解锁");
|
||||
setLock_screen(0, context, "");
|
||||
break;
|
||||
case KILL_SERVER:
|
||||
ToastUtil.betaShow("收到管控:停止应用");
|
||||
JSONObject killJSONObject = JSON.parseObject(extras);
|
||||
String packages = killJSONObject.getString("package_name");
|
||||
JGYUtils.getInstance().killBackgroundProcesses(context, packages);
|
||||
break;
|
||||
case TIME_CONTROL:
|
||||
ToastUtil.betaShow("收到管控:使用时间管控");
|
||||
getTimeControl(context, extras);
|
||||
break;
|
||||
case TOP_APP:
|
||||
ToastUtil.betaShow("收到管控:应用霸屏");
|
||||
getTopApp(context, extras);
|
||||
break;
|
||||
case LOGO_IMG:
|
||||
ToastUtil.betaShow("收到管控:开机动画设置");
|
||||
setBootanimation(context, extras);
|
||||
Logutils.e(TAG, "processCustomMessage: " + extras);
|
||||
break;
|
||||
case DEFAULTP_APP:
|
||||
ToastUtil.betaShow("收到管控:");
|
||||
setDefalutApp(context, extras);
|
||||
break;
|
||||
case PLAY_SOUND:
|
||||
ToastUtil.betaShow("收到管控:查找设备");
|
||||
playSound(context, extras);
|
||||
break;
|
||||
case CLEAN_APP_CACHE:
|
||||
ToastUtil.betaShow("收到管控:应用缓存清除");
|
||||
cleanCache(context, extras);
|
||||
break;
|
||||
case DEVELOPER_OPTIONS:
|
||||
ToastUtil.betaShow("收到管控:开发人员选项管控");
|
||||
setDeveloperoptions(extras);
|
||||
break;
|
||||
case GLOBAL_UPDATE:
|
||||
ToastUtil.betaShow("收到管控:全局更新");
|
||||
GlobalUpdate(extras);
|
||||
break;
|
||||
case EBAG_CODE:
|
||||
ToastUtil.betaShow("收到管控:电子书包激活码");
|
||||
setEbagCode(extras);
|
||||
JGYUtils.getInstance().killBackgroundProcesses(context, "com.jxw.launcher");
|
||||
break;
|
||||
case UPDATE_WHITELIST:
|
||||
ToastUtil.betaShow("收到管控:更新白名单");
|
||||
HTTPInterface.getAppLimit(mContext);
|
||||
break;
|
||||
case UPDATE_BATCH:
|
||||
ToastUtil.betaShow("收到管控:更换批次不恢复出厂设置");
|
||||
Aria.download(this).removeAllTask(true);
|
||||
try {
|
||||
new CacheUtils().cleanApplicationUserData(mContext, "com.android.browser");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Logutils.e(TAG, "setHomepagtag: " + e.getMessage());
|
||||
}
|
||||
if (MainService.mPresenter != null) {
|
||||
MainService.mPresenter.getLockedState();
|
||||
Logutils.e("getLockedState", "mPresenter: " + "getLockedState");
|
||||
} else {
|
||||
Logutils.e("getLockedState", "mPresenter is NULL");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setLock_screen(int state, Context context, String name) {
|
||||
if (ServiceAliveUtils.isServiceAlive(context)) {
|
||||
context.startService(new Intent(context, MainService.class));
|
||||
}
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("name", name);
|
||||
if (state == 1) {
|
||||
intent.setAction(MainService.LockScreenReceiver.action_lock);
|
||||
} else if (state == 0) {
|
||||
intent.setAction(MainService.LockScreenReceiver.action_unlock);
|
||||
}
|
||||
context.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
private void doDownloadAndInstall(String jsonString) {
|
||||
File file = new File(PathUtils.getExternalDownloadsPath() + "/jgy/");
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
if (TextUtils.isEmpty(jsonString)) {
|
||||
Logutils.e(TAG, "doDownloadAndInstall: extras is null");
|
||||
return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(jsonString);
|
||||
String app_name = jSONObject.getString("app_name");
|
||||
String app_package = jSONObject.getString("bg");
|
||||
String app_url = jSONObject.getString("app_url");
|
||||
int app_version_code = jSONObject.getInteger("app_version_code");
|
||||
String app_id = jSONObject.getString("app_id");
|
||||
String MD5 = jSONObject.getString("app_md5");
|
||||
JSONObject packageObj = new JSONObject();
|
||||
packageObj.put("app_name", app_name);
|
||||
packageObj.put("app_package", app_package);
|
||||
packageObj.put("app_id", app_id);
|
||||
packageObj.put("MD5", MD5);
|
||||
Logutils.e(TAG, "doDownloadAndInstall: app_package:" + app_package);
|
||||
Logutils.e(TAG, "doDownloadAndInstall: app_url:" + app_url);
|
||||
SaveListUtils.addList(app_package);
|
||||
SaveListUtils.sendForceAPP(mContext);
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
packageInfo = pm.getPackageInfo(app_package, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (packageInfo == null) {
|
||||
Logutils.e(TAG, "doDownloadAndInstall: " + app_package + "未安装");
|
||||
if (!SaveListUtils.isDownLoading(app_url)) {
|
||||
Logutils.e(TAG, "doDownloadAndInstall: " + app_package + "开始下载");
|
||||
Utils.ariaDownload(mContext, app_url, packageObj);
|
||||
}
|
||||
} else {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = packageInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = packageInfo.versionCode;
|
||||
}
|
||||
if (app_version_code > appVersionCode) {
|
||||
if (!SaveListUtils.isDownLoading(app_url)) {
|
||||
Utils.ariaDownload(mContext, app_url, packageObj);
|
||||
}
|
||||
} else {
|
||||
Logutils.e(TAG, "doDownloadAndInstall: " + app_package + "已安装最新版");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getBatteryLevel() {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
return ((BatteryManager) this.mContext.getSystemService(Context.BATTERY_SERVICE)).getIntProperty(4);
|
||||
}
|
||||
Intent intent = (new ContextWrapper(this.mContext)).registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
|
||||
return intent.getIntExtra("level", -1) * 100 / intent.getIntExtra("scale", -1);
|
||||
}
|
||||
|
||||
private void getDeselectBrowerID() {
|
||||
HTTPInterface.setBrowserBlackList(mContext);//浏览器网址管控
|
||||
}
|
||||
|
||||
private void getDeselectID() {
|
||||
NetInterfaceManager.getInstance().getDeselectIDApi()
|
||||
.getDeselectIDApi(NetInterfaceManager.HTTP_KEY,
|
||||
Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable param1Disposable) {
|
||||
Logutils.e("getDeselectID", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(ResponseBody param1ResponseBody) {
|
||||
String ids = "";
|
||||
String packages = "";
|
||||
try {
|
||||
String responString = param1ResponseBody.string();
|
||||
Logutils.e("getDeselectID", "onNext: " + responString);
|
||||
JSONObject jSONObject = JSON.parseObject(responString);
|
||||
int code = jSONObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
ids = jSONObject.getJSONObject("data").getString("ids");
|
||||
packages = jSONObject.getJSONObject("data").getString("package");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logutils.e("getDeselectID", "onNext: Exception: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem(ids, packages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable param1Throwable) {
|
||||
Logutils.e("getDeselectID", "onError: " + param1Throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Logutils.e("getDeselectID", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void setDisableSlideList(String s) {
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
Logutils.e("setDisableSlideList", "jSONObject::" + jSONObject.toString());
|
||||
String strban = jSONObject.getString("ban");
|
||||
String strnot = jSONObject.getString("not");
|
||||
String qch_disable_slide = Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_disable_slide");
|
||||
Logutils.e("fht", "qch_disable_slide::" + qch_disable_slide);
|
||||
|
||||
if (!TextUtils.isEmpty(strban)) {
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_disable_slide", strban);
|
||||
Logutils.e("fht", "sendban::" + strban);
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_disable_slide", "Invalid");
|
||||
}
|
||||
Logutils.e("fht", "qch_disable_slide::" + Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_disable_slide"));
|
||||
}
|
||||
|
||||
private void setDisableUpdateList(String s) {
|
||||
Logutils.e("setDisableUpdateList", s);
|
||||
JSONObject jsonObject = JSON.parseObject(s);
|
||||
String ban = jsonObject.getString("ban");
|
||||
String not = jsonObject.getString("not");
|
||||
String[] banList = ban.split(",");
|
||||
String[] notList = not.split(",");
|
||||
boolean b = Utils.writeDisableUpdateList(mContext, banList, notList);
|
||||
HTTPInterface.getAppLimit(mContext);
|
||||
}
|
||||
|
||||
private void settingCamera(String s) {
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
Intent intent = new Intent("qch_camera_forbid").setPackage("com.android.settings");
|
||||
intent.putExtra("camera_package_name", "close");
|
||||
this.mContext.sendBroadcast(intent);
|
||||
Logutils.e(TAG, "settingNetControl extras is null");
|
||||
return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
String s1 = jSONObject.getString("ban");
|
||||
// String str = jSONObject.optString("not");
|
||||
Logutils.e("settingCamera", "ban::" + s1);
|
||||
// Logutils.e("settingCamera", "not::" + str);
|
||||
if ("0".equals(s1)) {
|
||||
Intent intent2 = new Intent("qch_camera_forbid").setPackage("com.android.settings");
|
||||
// intent2.putExtra("camera_package_name", s1);
|
||||
this.mContext.sendBroadcast(intent2);
|
||||
} else {
|
||||
Intent intent1 = new Intent("qch_camera_open").setPackage("com.android.settings");
|
||||
// intent1.putExtra("camera_package_name", str);
|
||||
this.mContext.sendBroadcast(intent1);
|
||||
}
|
||||
}
|
||||
|
||||
private void settingOneNet(String s) {
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
Logutils.e(TAG, "settingNetControl extras is null");
|
||||
// return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
Logutils.e("settingOneNet", "jSONObject::" + jSONObject.toString());
|
||||
|
||||
String packages = jSONObject.getString("package");
|
||||
String status = jSONObject.getString("status");
|
||||
}
|
||||
|
||||
private void settingNetControl(String s) {
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
Logutils.e(TAG, "settingNetControl extras is null");
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
Logutils.e("settingNetControl", "jSONObject::" + jSONObject.toString());
|
||||
String disallow = jSONObject.getString("ban");
|
||||
String allow = jSONObject.getString("not");
|
||||
HashSet<String> disallowApp = new HashSet<>(Arrays.asList(disallow.split(",")));
|
||||
JGYUtils.setAppNetwork(mContext, disallowApp);
|
||||
}
|
||||
|
||||
private void settingPowerOn(String s) {
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
Logutils.e(TAG, "settingPowerOn extras is null");
|
||||
return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
String ban = jSONObject.getString("ban");
|
||||
String not = jSONObject.getString("not");
|
||||
Logutils.e(TAG, "settingPowerOn: qch_app_power_on = " + not);
|
||||
if (TextUtils.isEmpty(not)) {
|
||||
//当 qch_app_power_on 的值为空时,会造成系统所有应用断网
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_app_power_on", "Invalid");
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_app_power_on", not);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void writeDeselectBrowserIDtoSystem(String s) {
|
||||
boolean bool = Settings.System.putString(this.mContext.getContentResolver(), "DeselectBrowserArray", s);
|
||||
Logutils.e("SystemSetting", "DeselectBrowserArray---------" + s);
|
||||
Logutils.e("SystemSetting", "DeselectBrowserArray---------" + bool);
|
||||
}
|
||||
|
||||
private void setHomepagtag(String s) {
|
||||
HTTPInterface.getHomePageBookmarks(mContext, null);
|
||||
}
|
||||
|
||||
private void setAPPinsideWebsite(String s) {
|
||||
//禁止app内部网页访问,包名用,隔开
|
||||
HTTPInterface.getAppinsideWeb(mContext, new HTTPInterface.GetAppinsideWebCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Logutils.e(TAG, "ononComplete: setAPPinsideWebsite");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 锁定设备
|
||||
*
|
||||
* @param s
|
||||
*/
|
||||
public void settingLock(String s) {
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
Logutils.e(TAG, "settingLock extras is null");
|
||||
return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
|
||||
int i = changeNum(jSONObject.getIntValue("lock"));
|
||||
Settings.System.putInt(this.mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, i);
|
||||
Logutils.e("SystemSetting", "qch_unlock_ipad---------" + i);
|
||||
|
||||
if (getBatteryLevel() >= CommonDatas.MIN_POWER) {
|
||||
Utils.doMasterClear(mContext);
|
||||
} else {
|
||||
MySQLData.SetBooleanData(mContext, CommonDatas.IS_RESET, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void screenshot(String s) {
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
long createTime = jSONObject.getLong("createTime");
|
||||
if (createTime != 0) {
|
||||
Logutils.e("createTime", String.valueOf(createTime));
|
||||
doscreenshot(createTime);
|
||||
}
|
||||
}
|
||||
|
||||
public void doscreenshot(final long time) {
|
||||
Observable.create(new ObservableOnSubscribe<Integer>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Integer> e) throws Exception {
|
||||
String filepath = mContext.getExternalFilesDir("db").getAbsolutePath();
|
||||
int n = CmdUtil.execute("screencap -p " + filepath + File.separator + time + ".db").code;
|
||||
e.onNext(n);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Integer>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Integer integer) {
|
||||
if (integer == 0) {
|
||||
uplaodImage(time);
|
||||
} else {
|
||||
Logutils.e("doss", "失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Logutils.e("doss", "Throwable=" + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void uplaodImage(long time) {
|
||||
String filepath = mContext.getExternalFilesDir("db").getAbsolutePath();
|
||||
// String filepath = mContext.getFileStreamPath("screenshot").getAbsolutePath();
|
||||
//放在app内部data下面
|
||||
File file = new File(filepath + File.separator + time + ".db");
|
||||
//不要直接使用常用图片格式
|
||||
if (!file.exists()) {
|
||||
Logutils.e("uplaodImage", "File does not exists");
|
||||
return;
|
||||
}
|
||||
//设置图片格式
|
||||
// RequestBody requestFile = RequestBody.create(MediaType.parse("image/jpg"), file);
|
||||
//File转RequestBody
|
||||
MediaType mediaType = MediaType.Companion.parse("image/png");
|
||||
RequestBody fileBody = RequestBody.Companion.create(file, mediaType);
|
||||
//设置一个file文件
|
||||
MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), fileBody);
|
||||
NetInterfaceManager.getInstance().getScreenshotApi()
|
||||
.sendScreenshot(Utils.getSerial(), time, body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("uplaodImage", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("uplaodImage", "onNext: " + baseResponse.msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("uplaodImage", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("uplaodImage", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getTimeControl(Context context, String extras) {
|
||||
HTTPInterface.getSnTimeControl(context);
|
||||
}
|
||||
|
||||
private void getTopApp(Context context, String extras) {
|
||||
JSONObject jsonObject = JSON.parseObject(extras);
|
||||
String packageName = jsonObject.getString("app_package");
|
||||
if (TextUtils.isEmpty(packageName)) {
|
||||
SPUtils.put(context, ForegroundAppUtil.TOPAPP_KEY, "");
|
||||
ForegroundAppUtil.setTopAppClass(context, "");
|
||||
} else {
|
||||
SPUtils.put(context, ForegroundAppUtil.TOPAPP_KEY, packageName);
|
||||
ForegroundAppUtil.setTopAppClass(context, packageName);
|
||||
ForegroundAppUtil.openTopApp(context);
|
||||
}
|
||||
}
|
||||
|
||||
private void setBootanimation(Context context, String extras) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(extras);
|
||||
int type = jsonObject.getInteger("type");
|
||||
if (type == 1) {
|
||||
String file_url = jsonObject.getString("file_url");
|
||||
String file_md5 = jsonObject.getString("file_md5");
|
||||
JGYUtils.getInstance().checkBootFile(file_url, file_md5);
|
||||
} else {
|
||||
JGYUtils.getInstance().removeBootanimation();
|
||||
}
|
||||
}
|
||||
|
||||
private void setDefalutApp(Context context, String extras) {
|
||||
if (TextUtils.isEmpty(extras)) {
|
||||
JGYUtils.getInstance().setDefaultDesktop("");
|
||||
} else {
|
||||
JSONObject jsonObject = JSON.parseObject(extras);
|
||||
String default_launcher = jsonObject.getString("default_launcher");
|
||||
if (TextUtils.isEmpty(default_launcher)) {
|
||||
JGYUtils.getInstance().setDefaultDesktop("");
|
||||
SPUtils.put(context, "default_launcher", "");
|
||||
|
||||
} else {
|
||||
JGYUtils.getInstance().setDefaultDesktop(default_launcher);
|
||||
SPUtils.put(context, "default_launcher", default_launcher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void playSound(Context context, String extras) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(extras);
|
||||
defaultCallMediaPlayer(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* 播放系统默认来电铃声
|
||||
*
|
||||
* @return MediaPlayer对象
|
||||
* @throws Exception
|
||||
*/
|
||||
MediaPlayer mediaPlayer;
|
||||
|
||||
public void defaultCallMediaPlayer(Context context) {
|
||||
if (mediaPlayer != null) {
|
||||
mediaPlayer.stop();
|
||||
mediaPlayer.release();
|
||||
}
|
||||
mediaPlayer = MediaPlayer.create(context, R.raw.test);
|
||||
try {
|
||||
// mediaPlayer.prepare();
|
||||
mediaPlayer.setLooping(false);
|
||||
int duration = mediaPlayer.getDuration() / 1000;
|
||||
Logutils.e(TAG, "defaultCallMediaPlayer: " + "duration: " + duration);
|
||||
int loop = 0;
|
||||
if (duration <= 1) {
|
||||
loop = 30;
|
||||
} else {
|
||||
loop = (30 / duration);
|
||||
}
|
||||
final int[] soundCount = {0};
|
||||
int finalLoop = loop;
|
||||
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
||||
@Override
|
||||
public void onCompletion(MediaPlayer mediaPlayer) {
|
||||
if (soundCount[0] <= finalLoop) {
|
||||
setMaxVolume(context);
|
||||
mediaPlayer.start();
|
||||
soundCount[0] += 1;
|
||||
Logutils.e(TAG, "onCompletion: " + "loop: " + finalLoop);
|
||||
Logutils.e(TAG, "onCompletion: " + "soundCount: " + soundCount[0]);
|
||||
} else {
|
||||
mediaPlayer.stop();
|
||||
mediaPlayer.release();
|
||||
Logutils.e(TAG, "onCompletion: " + "loop: " + finalLoop);
|
||||
Logutils.e(TAG, "onCompletion: " + "soundCount: " + soundCount[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
mediaPlayer.setLooping(false);
|
||||
setMaxVolume(context);
|
||||
mediaPlayer.start();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Logutils.e(TAG, "defaultCallMediaPlayer: " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setMaxVolume(Context context) {
|
||||
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
|
||||
int ringMax = audioManager.getStreamMaxVolume(AudioManager.STREAM_RING);
|
||||
int musicMax = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
||||
int voiceMax = audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL);
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_RING, ringMax, 0);
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, voiceMax, 0);
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, musicMax, 0); //音乐音量
|
||||
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
audioManager.setSpeakerphoneOn(true);
|
||||
}
|
||||
|
||||
|
||||
private void cleanCache(Context context, String extras) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(extras);
|
||||
String packageName = jsonObject.getString("app_package");
|
||||
if (TextUtils.isEmpty(packageName)) {
|
||||
Logutils.e(TAG, "cleanCache: " + "package is empty");
|
||||
} else {
|
||||
try {
|
||||
if (new CacheUtils().cleanApplicationUserData(context, packageName)) {
|
||||
Logutils.e(TAG, "cleanCache: " + packageName + " success");
|
||||
} else {
|
||||
Logutils.e(TAG, "cleanCache: " + packageName + " failed");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Logutils.e(TAG, "cleanCache: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setDeveloperoptions(String extras) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(extras);
|
||||
int is_developer = jsonObject.getInteger("is_developer");
|
||||
Logutils.e(TAG + ":" + "getDeveloper", "onNext: " + is_developer);
|
||||
Logutils.e(TAG, "setDeveloperoptions: " + is_developer);
|
||||
JGYUtils.getInstance().setDeveloperOptions(is_developer == 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
private void GlobalUpdate(String jsonString) {
|
||||
if (TextUtils.isEmpty(jsonString)) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(jsonString);
|
||||
String platform = jsonObject.getString("platform");
|
||||
if (JGYUtils.getInstance().isSamePlatform(platform)) {
|
||||
checkAPPInstall(jsonObject);
|
||||
} else {
|
||||
Logutils.e(TAG, "GlobalUpdate: " + "应用与app平台不符合");
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void checkAPPInstall(JSONObject jsonObject) {
|
||||
long version_code = jsonObject.getLong("app_version_code");
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
packageInfo = pm.getPackageInfo(jsonObject.getString("app_package"), 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (packageInfo == null || packageInfo.getLongVersionCode() < version_code) {
|
||||
Utils.ariaDownload(mContext, jsonObject.getString("app_url"), jsonObject);
|
||||
} else {
|
||||
Logutils.e(TAG, "checkAPPInstall: " + "已经是最新版");
|
||||
}
|
||||
}
|
||||
|
||||
private void setEbagCode(String jsonString) {
|
||||
JSONObject jsonObject = JSON.parseObject(jsonString);
|
||||
String ebagCode = jsonObject.getString("ebagCode");
|
||||
if (TextUtils.isEmpty(ebagCode)) {
|
||||
Logutils.e(TAG, "setEbagCode: " + "ebagCode is empty");
|
||||
} else {
|
||||
SPUtils.put(mContext, "ebagCode", ebagCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user