# 接入指南

### 1.开发环境

由于最终集成SDK的软件需要安装至智能主机上\
因此开发方式为原生App开发因此需要具有Android开发环境,推荐使用Android Studio开发工具\
请开发者优先配置好Android的开发环境后进行开发

### 2.对接Demo下载

{% embed url="<https://github.com/youzhuan2019/SmartHomeAppDemo>" %}

使用 Android Studio 导入此Demo编译运行到智能主机上即可实现通信

### 3.智能主机如何导入设备

1.选择添加方式为 智能家居服务发现  &#x20;

![](/files/-MEMojalIgCbLxjBSgMX)

2.登录智能家居平台

![](/files/-MEQDpl_V-taY_UrEpIz)

3.登录成功后进入设备添加界面

选中设备后点击确认添加即可将设备导入到智能主机中进行控制

![](/files/-MEQGQvbzEXCxOrpgPdw)

### 4.获取智能家居开发包

链接: <https://pan.baidu.com/s/1X_2uclN3VDJ7BW2V10t9wA> 提取码: 6aaz

### 5.项目配置

5.1在AndroidStudio Module级别下配置build.gradle

```
repositories {
    flatDir {
        dirs 'libs'
    }
}
dependencies {
    implementation name: 'yz_iot_v0.1',ext:"aar"
    implementation 'com.github.zhaokaiqiang.klog:library:1.6.0'
    implementation 'com.alibaba:fastjson:1.1.71.android'
}
```

5.2创建类并继承自YzIotService实现父类方法并配置AndroidManifest.xml

```
public class CustomService extends YzIotService {
    ..........
}
```

配置AndroidManifest.xml并注册该服务类

```
<service android:name=".CustomService">
    <intent-filter>
        <action android:name="com.youzhuan.iotserver"/>
    </intent-filter>
</service>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.youzhuan.net/dev-link-host/android-link-sdk/link-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
