完成集成令牌测试
This commit is contained in:
@@ -7,12 +7,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.mogo.cloud.httpdns.MogoHttpDnsConfig;
|
||||
import com.mogo.cloud.passport.IMoGoTokenCallback;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 鉴权sdk测试页面
|
||||
@@ -27,8 +22,6 @@ public class PassPortActivity extends AppCompatActivity {
|
||||
private TextView tvSn;
|
||||
private TextView tvToken;
|
||||
|
||||
private MoGoAiCloudClient mMoGoAiCloudClient;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -41,35 +34,10 @@ public class PassPortActivity extends AppCompatActivity {
|
||||
tvSn = findViewById(R.id.tvSn);
|
||||
tvToken = findViewById(R.id.tvToken);
|
||||
|
||||
Random random = new Random();
|
||||
double randomLat = random.nextDouble();
|
||||
double randomLon = random.nextDouble();
|
||||
|
||||
MoGoAiCloudClientConfig clientConfig = new MoGoAiCloudClientConfig();
|
||||
clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_QA);
|
||||
clientConfig.setThirdLogin(true);
|
||||
clientConfig.setShowDebugLog(true);
|
||||
clientConfig.setThirdPartyAppKey("bydauto");
|
||||
clientConfig.setThirdPartyDeviceId("bydauto");
|
||||
clientConfig.setLat(randomLat);
|
||||
clientConfig.setLon(randomLon);
|
||||
clientConfig.setCityCode("010");
|
||||
clientConfig.setLoopCheckDelay(15 * 1000);
|
||||
|
||||
mMoGoAiCloudClient = MoGoAiCloudClient.getInstance().init(this, clientConfig);
|
||||
|
||||
btnRefreshToken.setOnClickListener(v -> mMoGoAiCloudClient.refreshToken(new IMoGoTokenCallback() {
|
||||
@Override
|
||||
public void onTokenGot(String token, String sn) {
|
||||
tvSn.setText(sn);
|
||||
tvToken.setText(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
|
||||
}
|
||||
}));
|
||||
btnRefreshToken.setOnClickListener(v -> {
|
||||
tvSn.setText(MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
|
||||
tvToken.setText(MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getToken());
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user