更新时间:2026-05-22 GMT+08:00
分享

应用生命周期回调

方法名称

void onAppLifeCycle(AppOperateResponse<AppLifeCycle> appOperateResponse)

功能描述

应用生命周期回调。该方法在应用生命周期状态更新时触发。

参数说明

字段名

类型

说明

appOperateResponse

AppOperateResponse

操作响应对象

回调参数

字段

类型

说明

error_code

String

状态码,0表示成功

error_msg

String

错误详情

data

AppLifeCycle

磁盘使用数据对象

AppLifeCycle

字段

类型

说明

packageName

String

应用包名

lifeCycleStatus

String

生命周期状态

  • 0:打开
  • 1:关闭(应用退出只需要处理状态为1的数据)

返回值

调用示例

/ 2. 注册回调接口(建议在初始化时注册一次) 
CloudPhoneClient.setAppCallback(new  CloudPhoneClient.Callback.AppCallback() { 
    @Override 
    public void onGetInstalledApps(AppOperateResponse<AppLifeCycle> response) { 
        if (response.isSuccess())  { 
           AppLifeCycle rsp = response.getData();  
          

        } else { 
            // 处理接口调用失败(如网络异常、参数错误等) 
            String errorMsg = response.getErrorMsg();  
            int errorCode = response.getErrorCode();  
        } 
    } 
}); 

相关文档