收藏
回答

安卓启动调用注册wmpf异常是什么原因?

AppID
wx9f97071da086d7d9

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")

}

回答关注问题邀请回答
收藏

1 个回答

  • 社区技术专员-gao
    社区技术专员-gao
    03-06

    请自行排查下是哪一句 exception, 参数是否合法。

    03-06
    有用
    回复
登录 后发表内容
问题标签