完成集成令牌测试
This commit is contained in:
@@ -30,7 +30,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
|
||||
// implementation project(path: ':foudations:mogo-passport')
|
||||
implementation 'com.mogo.cloud:passport:1.0.0'
|
||||
implementation project(path: ':foudations:mogo-passport')
|
||||
// implementation 'com.mogo.cloud:passport:1.0.0'
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
package="com.mogo.cloud">
|
||||
|
||||
<application
|
||||
android:name=".MoGoApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
|
||||
37
app/src/main/java/com/mogo/cloud/MoGoApplication.java
Normal file
37
app/src/main/java/com/mogo/cloud/MoGoApplication.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.mogo.cloud.httpdns.MogoHttpDnsConfig;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class MoGoApplication extends Application {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
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);
|
||||
|
||||
MoGoAiCloudClient.getInstance().init(this, clientConfig);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,8 @@ public class MoGoAiCloudClient {
|
||||
mAiCloudClientConfig = aiCloudClientConfig;
|
||||
// 设置鉴权的网络环境
|
||||
LoginManager.getInstance(context).setNetEnviron(aiCloudClientConfig.getNetMode());
|
||||
// 刷新令牌
|
||||
refreshToken(null);
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user