66 1
This commit is contained in:
@@ -161,7 +161,7 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
//设置mqtt环境 false 测试环境 true 正式环境
|
||||
// ExternalResConstants.INSTANCE.setIS_MQTT_RELEASE(false);
|
||||
//设置http环境 false 测试环境 true 正式环境
|
||||
ExternalResConstants.INSTANCE.setIS_HTTP_RELEASE(false);
|
||||
ExternalResConstants.INSTANCE.setIS_HTTP_RELEASE(true);
|
||||
currentEnvironment = ExternalResConstants.INSTANCE.HTTP_PATH();
|
||||
|
||||
initialization();
|
||||
@@ -438,24 +438,12 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
if (SpUtil.isAgreePolicy()) {
|
||||
checkInEmulator();
|
||||
// UtilConfig.checkInEmulator();
|
||||
AgoraManager.getInstance();
|
||||
MessageListenerSingleton.getInstance();
|
||||
CrashReport.initCrashReport(this, "b45883f58f", true);/*bugly初始化*/
|
||||
// // 启动 MQTT 服务
|
||||
// Intent mqttServiceIntent = new Intent(this, MyMqttService.class);
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// startForegroundService(mqttServiceIntent);
|
||||
// } else {
|
||||
// startService(mqttServiceIntent);
|
||||
// }
|
||||
|
||||
// mqttConnect=MqttConnect.getInstance(this, currentEnvironment.getMqttUrl(),"android-"+ MqttClient.generateClientId());
|
||||
// mqttConnect=MqttConnect.getInstance(this,"tcp://1.13.101.98","android-"+ MqttClient.generateClientId());
|
||||
// mqttConnect.mqttClient();
|
||||
CrashReport.initCrashReport(this, "b45883f58f", true);/*bugly初始化*/
|
||||
|
||||
// 每次启动应用时重置状态
|
||||
SpUtil.getInstance().setBooleanValue("youth_model_shown", false);
|
||||
startInitSdk();
|
||||
|
||||
// 初始化(通常在Application或Activity的onCreate中)
|
||||
CosUploadManager.getInstance(CommonAppContext.getInstance());
|
||||
}
|
||||
@@ -527,9 +515,12 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
public void upMqtt(){
|
||||
if (mqttConnect == null){
|
||||
mqttConnect=MqttConnect.getInstance(this, currentEnvironment.getMqttUrl(),"android-"+ MqttClient.generateClientId());
|
||||
// mqttConnect=MqttConnect.getInstance(this,"tcp://1.13.101.98","android-"+ MqttClient.generateClientId());
|
||||
mqttConnect.mqttClient();
|
||||
}
|
||||
|
||||
AgoraManager.getInstance();
|
||||
MessageListenerSingleton.getInstance();
|
||||
startInitSdk();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -764,6 +755,11 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
// 每次启动应用时重置状态
|
||||
SpUtil.setBooleanValue("youth_model_shown", false);
|
||||
|
||||
if (mqttConnect != null){
|
||||
mqttConnect.close();
|
||||
}
|
||||
|
||||
|
||||
// 发送广播通知所有Activity刷新状态
|
||||
Intent refreshIntent = new Intent("com.xscm.moduleutil.ACTION_USER_LOGOUT");
|
||||
sendBroadcast(refreshIntent);
|
||||
|
||||
@@ -74,6 +74,15 @@ public class RetrofitClient {
|
||||
boolean isNetworkAvailable = checkNetworkConnection(); // 实现这个方法来检查网络状态
|
||||
String cacheControl = isNetworkAvailable ? "max-age=0" : "only-if-cached, max-stale=86400";
|
||||
|
||||
private JoinRoomLoadListener joinRoomLoadListener;
|
||||
|
||||
public interface JoinRoomLoadListener {
|
||||
void onJoinRoomLoad(String result);
|
||||
}
|
||||
public void setJoinRoomLoadListener(JoinRoomLoadListener joinRoomLoadListener) {
|
||||
this.joinRoomLoadListener = joinRoomLoadListener;
|
||||
}
|
||||
|
||||
private boolean checkNetworkConnection() {
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) CommonAppContext.getInstance().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
@@ -2248,6 +2257,9 @@ public class RetrofitClient {
|
||||
}
|
||||
} else if (roomInfoRespBaseModel.getCode() == 0) {
|
||||
ToastUtils.showShort(roomInfoRespBaseModel.getMsg());
|
||||
if (joinRoomLoadListener != null){
|
||||
joinRoomLoadListener.onJoinRoomLoad(roomInfoRespBaseModel.getMsg());
|
||||
}
|
||||
}else if (roomInfoRespBaseModel.getCode() == 202){
|
||||
observer.onNext(roomInfoRespBaseModel.getData());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user