error: com.tencent.wmpf.cli.api.WMPFApiException: errType: 1, errCode: -1, errMsg: Error Loading Attributes
CoroutineScope(Dispatchers.IO).launch {
try {
WMPFBoot.init(application, wmpfDevice)
val deviceApi = WMPF.getInstance().deviceApi
deviceApi.registerDeviceActivationOutdatedEventListener(object :
AbstractOnDeviceActivationOutdatedEventListener() {
override fun onInvoke(p0: IPCVoid) {
LogHelper.i(TAG, "设备激活已失效,可能超时或被其他设备占用")
activiteDevice()
}
})
isInitFinish = true
val miniProgramDeviceApi = WMPF.getInstance().miniProgramDeviceApi
val response = miniProgramDeviceApi.registerMiniProgramDevice(
confModel.miniProgramAppId,
confModel.modelId,
wmpfDevice.deviceId,
snTicket
)
val code = response.code
val errMsg = response.errMsg
if (code == 0) {
LogHelper.i(TAG, "registerMiniProgramDevice success")
} else {
LogHelper.e(TAG, "registerMiniProgramDevice code: $code fail: $errMsg")
}
WMPF.getInstance().settingApi.setSetting("configSuicideTimeoutSeconds", "1")
WMPF.getInstance().settingApi.setSetting("configSuspendTimeoutSeconds", "1")
WMPF.getInstance().settingApi.setSetting("configNoBackground", "true")
WMPFLifecycleManager.getInstance().addWMPFLifecycleListener(object :
WMPFLifecycleListener {
override fun onMiniProgramForeground(appId: String?) {
super.onMiniProgramForeground(appId)
RouterManager.getPageRouter()?.backToHome()
AppExitManager.isAdminExit = true
// val intent = Intent(
// ApplicationHelp.getApplication(),
// WMPFTopCoverService::class.java
// )
// intent.putExtra("action", "SHOW")
// startService(intent)
}
override fun onMiniProgramBackground(appId: String?) {
super.onMiniProgramBackground(appId)
AppExitManager.isAdminExit = false
// CoroutineScope(Dispatchers.IO).launch {
// (EcsSDKManager.getSingletonSdk() as? XMSDKImpl)?.closeFlashlight()
// }
// val intent = Intent(
// ApplicationHelp.getApplication(),
// WMPFTopCoverService::class.java
// )
// intent.putExtra("action", "HIDE")
// startService(intent)
}
})
if (deviceApi.isDeviceActivated) {
preload()
} else {
LogHelper.i(TAG, "设备未激活")
}
} catch (e: WMPFApiException) {
LogHelper.i(TAG, "error: $e")
} catch (e: IllegalStateException) {
LogHelper.i(TAG, "error: $e")
}
LogHelper.i(TAG, "initWMPF, end")
}
请自行排查下是哪一句 exception, 参数是否合法。