72 lines
2.3 KiB
Java
72 lines
2.3 KiB
Java
package com.mogo.cloud;
|
|
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
import android.widget.Button;
|
|
import android.widget.EditText;
|
|
import android.widget.TextView;
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
import com.mogo.cloud.passport.IMoGoTokenCallback;
|
|
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
|
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
|
|
|
import static com.mogo.cloud.passport.MoGoAiCloudClientConfig.NET_MODE_QA;
|
|
|
|
/**
|
|
* 鉴权sdk测试页面
|
|
*/
|
|
public class PassPortActivity extends AppCompatActivity {
|
|
|
|
|
|
private EditText etAppKey;
|
|
private EditText etDevicesId;
|
|
private EditText etSignSecret;
|
|
private Button btnRefreshToken;
|
|
private TextView tvSn;
|
|
private TextView tvToken;
|
|
|
|
private MoGoAiCloudClient mMoGoAiCloudClient;
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
setContentView(R.layout.activity_pass_port_actvity);
|
|
etAppKey = findViewById(R.id.etAppKey);
|
|
etDevicesId = findViewById(R.id.etDevicesId);
|
|
etSignSecret = findViewById(R.id.etSignSecret);
|
|
btnRefreshToken = findViewById(R.id.btnRefreshToken);
|
|
tvSn = findViewById(R.id.tvSn);
|
|
tvToken = findViewById(R.id.tvToken);
|
|
|
|
MoGoAiCloudClientConfig clientConfig = new MoGoAiCloudClientConfig();
|
|
clientConfig.setNetMode(NET_MODE_QA);
|
|
clientConfig.setThirdLogin(true);
|
|
clientConfig.setThirdPartyAppKey("f8xx");
|
|
clientConfig.setThirdPartyDeviceId("f8xx");
|
|
clientConfig.setThirdPartySignSecret("f8xx");
|
|
clientConfig.setThirdPartyAppKey("6bbe7e0e1ecd8e2f8dc336e1678a2791");
|
|
|
|
mMoGoAiCloudClient = MoGoAiCloudClient.getInstance().init(this,clientConfig);
|
|
|
|
btnRefreshToken.setOnClickListener(new View.OnClickListener() {
|
|
@Override
|
|
public void onClick(View 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) {
|
|
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
} |