HarmonyOS Connect原子化服务功能开发设备控制开发与实现(二)
原创
常规设备控制1.在“device”目录下的“DeviceApplication.java”文件中,在onInitialize函数中初始化应用。示例代码如下:OverridepublicvoidonInitialize(){AiLifeServiceHelper.initApplication(this);DeviceHandlerAbility.register(this,"");super.onInitialize();}OverridepublicvoidonEnd(){super.onEnd();DeviceHandlerAbility.deregister();AiLifeServiceHelper.disconnect();}2.在“device”目录下的“DeviceHandlerAb...