增加了配置信息为单例模式
This commit is contained in:
26
app/src/main/java/com/mogo/cloud/ConfigInfoActivity.java
Normal file
26
app/src/main/java/com/mogo/cloud/ConfigInfoActivity.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
/**
|
||||
* 查看配置信息
|
||||
*/
|
||||
public class ConfigInfoActivity extends AppCompatActivity {
|
||||
|
||||
private TextView tvConfigInfo;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.actitity_config_info);
|
||||
tvConfigInfo = findViewById(R.id.tvConfigInfo);
|
||||
tvConfigInfo.setText(GsonUtil.jsonFromObject(MoGoAiCloudClientConfig.getInstance()));
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private Button btnJumpPassPort;
|
||||
private Button btnJumpConfigInfo;
|
||||
private Button btnJumpNetWorkPort;
|
||||
private Button btnJumpRealTime;
|
||||
private Button btnJumpRoadCondition;
|
||||
@@ -57,6 +58,12 @@ public class MainActivity extends AppCompatActivity {
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
btnJumpConfigInfo = findViewById(R.id.btnJumpConfigInfo);
|
||||
btnJumpConfigInfo.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(MainActivity.this, ConfigInfoActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
MoGoAiCloudClient.getInstance().addTokenCallbacks(new IMoGoTokenCallback() {
|
||||
@Override
|
||||
public void onTokenGot(String token, String sn) {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class MoGoApplication extends MultiDexApplication {
|
||||
* BYD:bydauto
|
||||
*/
|
||||
// 配置云服务API
|
||||
MoGoAiCloudClientConfig clientConfig = new MoGoAiCloudClientConfig();
|
||||
MoGoAiCloudClientConfig clientConfig = MoGoAiCloudClientConfig.getInstance();
|
||||
// 设置网络环境:HTTP_DNS_ENV_QA、HTTP_DNS_ENV_RELEASE、HTTP_DNS_ENV_DEV
|
||||
clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_QA);
|
||||
// 设置是否是第三APP登录
|
||||
@@ -59,8 +59,7 @@ public class MoGoApplication extends MultiDexApplication {
|
||||
});
|
||||
|
||||
// 初始化SDK,可以设置状态回调来监听
|
||||
MoGoAiCloudClient.getInstance().init(
|
||||
this, clientConfig);
|
||||
MoGoAiCloudClient.getInstance().init(this, clientConfig);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user