version:2.0
fix:修复不能初始化推送,修复地图定位,修复下载缓存乱码 update:
This commit is contained in:
@@ -42,7 +42,9 @@ public class AmapManager {
|
||||
}
|
||||
|
||||
public void initAmap() {
|
||||
mLocationClient = new LocationClient(mContext);
|
||||
if (mLocationClient == null) {
|
||||
mLocationClient = new LocationClient(mContext);
|
||||
}
|
||||
mLocationClient.setLocOption(getDefaultLocationClientOption());
|
||||
mLocationClient.registerLocationListener(mListener);
|
||||
mLocationClient.stop();
|
||||
|
||||
@@ -1080,7 +1080,9 @@ public class NetInterfaceManager {
|
||||
if (ConnectManager.getInstance().isNeedConnect(JGYUtils.FUXIAOYING_KEY, connectMode)) {
|
||||
checkFXYAppUpdate(lifecycle, callback);
|
||||
} else {
|
||||
String jsonString = mCacheHelper.getAsString(JGYUtils.FUXIAOYING_KEY);
|
||||
//有乱码
|
||||
String jsonString = mMMKV.decodeString(JGYUtils.FUXIAOYING_KEY + "_mmkv");
|
||||
Log.e(TAG, "checkFXYAppUpdate: jsonString = " + jsonString);
|
||||
//为 "" 是已经请求成功的
|
||||
if (jsonString == null) {
|
||||
checkFXYAppUpdate(lifecycle, callback);
|
||||
@@ -1928,7 +1930,7 @@ public class NetInterfaceManager {
|
||||
softwareJson.addProperty("jpush_id", "");
|
||||
softwareJson.addProperty("notice_version", ApkUtils.getAPPVersionName(mContext, "com.uiui.info"));
|
||||
softwareJson.addProperty("browser_version", ApkUtils.getAPPVersionName(mContext, "com.uiui.browser"));
|
||||
softwareJson.addProperty("desktop_version", ApkUtils.getAPPVersionName(mContext, "com.uiui.os"));
|
||||
softwareJson.addProperty("desktop_version", ApkUtils.getAPPVersionName(mContext, "com.fuying.fuxiaoying"));
|
||||
|
||||
String addr = jsonObject.toString();
|
||||
String machine = Utils.getMachine(mContext);
|
||||
|
||||
@@ -21,11 +21,15 @@ import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.baidu.location.BDAbstractLocationListener;
|
||||
import com.baidu.location.BDLocation;
|
||||
import com.baidu.location.LocationClient;
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.fuying.sn.BuildConfig;
|
||||
import com.fuying.sn.bean.BaseResponse;
|
||||
import com.fuying.sn.bean.SnInfo;
|
||||
import com.fuying.sn.config.CommonConfig;
|
||||
import com.fuying.sn.manager.AmapManager;
|
||||
import com.fuying.sn.manager.ConnectManager;
|
||||
import com.fuying.sn.manager.ControlManager;
|
||||
import com.fuying.sn.network.NetInterfaceManager;
|
||||
@@ -110,7 +114,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
ToastUtil.show("网络已连接");
|
||||
String WiFiAlias = Utils.getWifiAlias(this);
|
||||
Log.e(TAG, "onConnected: WiFiAlias = " + WiFiAlias);
|
||||
Utils.getPublicIP(this);
|
||||
if (ConnectManager.getInstance().isWiFiFistConnect()) {
|
||||
start.onstar(ConnectManager.WIFI_LAST_CONNECT_TIME);
|
||||
} else {
|
||||
@@ -119,11 +122,17 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
}
|
||||
}
|
||||
//第一次开机联网后直接连接
|
||||
if ((int) SPUtils.get(this, CommonConfig.JGY_FIRST_BOOT, 0) == 0) {
|
||||
mPresenter.getSnInfo();
|
||||
mPresenter.getAllApp();
|
||||
SPUtils.put(this, CommonConfig.JGY_FIRST_BOOT, 1);
|
||||
}
|
||||
// TODO: 2022/11/21 有些设备联网了但是立刻请求还是失败
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if ((int) SPUtils.get(MainService.this, CommonConfig.JGY_FIRST_BOOT, 0) == 0) {
|
||||
mPresenter.getSnInfo();
|
||||
mPresenter.getAllApp();
|
||||
SPUtils.put(MainService.this, CommonConfig.JGY_FIRST_BOOT, 1);
|
||||
}
|
||||
}
|
||||
}, 15000);
|
||||
sendDeviceInfo();
|
||||
}
|
||||
|
||||
@@ -150,8 +159,14 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
mPresenter.setLifecycle(lifecycleSubject);
|
||||
mPresenter.attachView(this);
|
||||
|
||||
NTPTimeTask task = new NTPTimeTask();
|
||||
task.execute("ntp.aliyun.com");
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
NTPTimeTask task = new NTPTimeTask();
|
||||
task.execute("ntp.aliyun.com");
|
||||
mPresenter.getAllApp();
|
||||
}
|
||||
}, 20000);
|
||||
|
||||
Log.e(TAG, "onCreate: IMEI = " + Utils.getIMEI(MainService.this));
|
||||
String aole_app_forbid = Settings.System.getString(getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID);
|
||||
@@ -159,7 +174,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
if (TextUtils.isEmpty(aole_app_forbid)) {
|
||||
ApkUtils.writeAppPackageList(MainService.this, "");
|
||||
}
|
||||
mPresenter.getAllApp();
|
||||
|
||||
ApkUtils.UninstallAPP(this, "com.joytv.live");
|
||||
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
||||
@@ -174,6 +188,10 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
.throttleFirst(6, TimeUnit.HOURS)
|
||||
.subscribe(timeObserver);
|
||||
|
||||
Observable.create(configsubscribe)
|
||||
.throttleLast(15, TimeUnit.SECONDS)
|
||||
.subscribe(configObserver);
|
||||
|
||||
if ((int) SPUtils.get(this, CommonConfig.JGY_FIRST_CONNECT, 0) == 0) {
|
||||
start.onstar(ConnectManager.REBOOT_LAST_ONNECT_TIME);
|
||||
}
|
||||
@@ -217,19 +235,72 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initConfig();
|
||||
NetInterfaceManager.getInstance().SendAppInstallInfo();
|
||||
NetInterfaceManager.getInstance().updateAdminInfo();
|
||||
}
|
||||
},10000);
|
||||
}, 15000);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.e(TAG, "onStartCommand: " + System.currentTimeMillis());
|
||||
configStart.onstar("onStartCommand");
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private void initConfig() {
|
||||
tPushInit();
|
||||
Utils.getPublicIP(MainService.this);
|
||||
LocationClient locationClient = AmapManager.getInstance().getLocationClient();
|
||||
locationClient.stop();
|
||||
locationClient.start();
|
||||
locationClient.registerLocationListener(new BDAbstractLocationListener() {
|
||||
@Override
|
||||
public void onReceiveLocation(BDLocation bdLocation) {
|
||||
Log.e("initConfig", "onReceiveLocation: ");
|
||||
NetInterfaceManager.getInstance().updateAdminInfo();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private interface ConfigStart {
|
||||
void onstar(String key);
|
||||
}
|
||||
|
||||
private ConfigStart configStart;
|
||||
|
||||
private ObservableOnSubscribe<String> configsubscribe = new ObservableOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||
configStart = emitter::onNext;
|
||||
}
|
||||
};
|
||||
|
||||
private Observer<String> configObserver = new Observer<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String string) {
|
||||
Log.e(TAG, "onNext: " + System.currentTimeMillis() + "\t" + string);
|
||||
initConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
Reference in New Issue
Block a user