|
|
|
@ -24,6 +24,8 @@ import com.aispeech.DUILiteConfig; |
|
|
|
import com.aispeech.DUILiteSDK; |
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route; |
|
|
|
import com.alibaba.android.arouter.launcher.ARouter; |
|
|
|
import com.google.gson.JsonObject; |
|
|
|
import com.google.gson.JsonParser; |
|
|
|
import com.iflytek.sparkchain.core.SparkChain; |
|
|
|
import com.iflytek.sparkchain.core.SparkChainConfig; |
|
|
|
import com.sdkapi.api.SdkApi; |
|
|
|
@ -427,27 +429,41 @@ public class UpdateFileActivity extends BaseActivity { |
|
|
|
|
|
|
|
// 思必驰授权
|
|
|
|
private void initSbcSDK(){ |
|
|
|
// 产品认证需设置 apiKey, productId, productKey, productSecret
|
|
|
|
DUILiteConfig config = new DUILiteConfig.Builder() |
|
|
|
.setApiKey("d823edab41b8d823edab41b868ecc552") |
|
|
|
.setProductId("279632533") |
|
|
|
.setProductKey("ab73065d16e11bcfac026eee3db9f6cb") |
|
|
|
.setProductSecret("85d9490c438099acc33be7676799399f") |
|
|
|
.create(); |
|
|
|
config.setExtraParameter("DEVICE_NAME", ""); |
|
|
|
DUILiteSDK.init(getApplicationContext()); |
|
|
|
// SDK 授权
|
|
|
|
DUILiteSDK.doAuth(getApplicationContext(), config, new DUILiteSDK.InitListener() { |
|
|
|
@Override |
|
|
|
public void success() { |
|
|
|
LoggerUtil.d("DUILiteSDKInit: ", "授权成功! "); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void error(String errorCode,String errorInfo) { |
|
|
|
LoggerUtil.d("DUILiteSDKInit: ", "授权失败, errorcode: "+errorCode+",errorInfo:"+errorInfo); |
|
|
|
String code = DeviceData.getDeviceInfo(DeviceData.VOICE_CODE); |
|
|
|
LoggerUtil.e("设备语音code: ", code); |
|
|
|
if(!StringUtil.isEmpty(code)){ |
|
|
|
String dataJson = DeviceData.getDeviceInfo(DeviceData.VOICE_CONFIG); |
|
|
|
JsonObject jsonObject = new JsonParser().parse(dataJson).getAsJsonObject(); |
|
|
|
String productId = jsonObject.get("productId").getAsString(); |
|
|
|
String apiKey = jsonObject.get("apiKey").getAsString(); |
|
|
|
String productKey = jsonObject.get("productKey").getAsString(); |
|
|
|
String productSecret = jsonObject.get("productSecret").getAsString(); |
|
|
|
if(!StringUtil.isEmpty(productId) && !StringUtil.isEmpty(apiKey) && !StringUtil.isEmpty(productKey) && !StringUtil.isEmpty(productSecret)){ |
|
|
|
DUILiteConfig config = new DUILiteConfig.Builder() |
|
|
|
.setApiKey(apiKey) |
|
|
|
.setProductId(productId) |
|
|
|
.setProductKey(productKey) |
|
|
|
.setProductSecret(productSecret) |
|
|
|
.create(); |
|
|
|
config.setExtraParameter("DEVICE_NAME", "abc123456def9876542"); |
|
|
|
DUILiteSDK.init(getApplicationContext()); |
|
|
|
// SDK 授权
|
|
|
|
DUILiteSDK.doAuth(getApplicationContext(), config, new DUILiteSDK.InitListener() { |
|
|
|
@Override |
|
|
|
public void success() { |
|
|
|
LoggerUtil.d("DUILiteSDKInit: ", "授权成功! "); |
|
|
|
} |
|
|
|
@Override |
|
|
|
public void error(String errorCode,String errorInfo) { |
|
|
|
LoggerUtil.d("DUILiteSDKInit: ", "授权失败, errorcode: "+errorCode+",errorInfo:"+errorInfo); |
|
|
|
} |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
LoggerUtil.e("initSDK: ","语音授权码获取失败"); |
|
|
|
} |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
LoggerUtil.e("initSDK: ","语音激活码获取失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|