# 自研APP接入

## 运行环境

{% content-ref url="/pages/V7G4uKVUp6TmGSfartxU" %}
[Requirements](/overview/requirements.md)
{% endcontent-ref %}

***

## 接入方式对比

| **接入方式**       | **优势**                            | **劣势**                                                    |
| -------------- | --------------------------------- | --------------------------------------------------------- |
| **WebAR SDK**  | + 能够支持更全面的系统版本 iOS 11+、Android 7+ | + 需要一定开发接入成本                                              |
| **系统 WebView** | + 开发接入成本较低                        | <p>+ 需支持 iOS 14.3+<br>+ 需 Android 5.0+，且系统 WebView 支持</p> |
| **浏览器组件**      | <p>+ 开发接入成本低<br>+ 支持 iOS 13+</p>  | /                                                         |

***

## 注意事项

无论何种方式接入，WebView组件的 UserAgent 属性，**不能改为非标准内容**。

Kivicube 会使用行业标准方式，从 UserAgent 获取浏览器基础信息。\
因此，一旦 UA 不标准，就会导致运行出现非预期效果，比如移动端访问被误判为 PC 端。

标准 UA 格式参考：\
[User-Agent - HTTP | MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/User-Agent)

建议的 UA 处理方法：\
在默认 UA 基础上，仅在末尾增加自己的关键词或标识信息。

**示例：微信 WebView UA**

* **微信完整 UA：**&#x4D;ozilla/5.0 (Linux; Android 15; wv) AppleWebKit/537.36 (KHTML, like Gecko)

  Version/4.0 Chrome/134.0.6998.136 Mobile Safari/537.36 XWEB/1340109 MMWEBSDK/20250201 MMWEBID/9925 MicroMessenger/8.0.58.2841(0x28003A3E)

  WeChat/arm64 Weixin NetType/WIFI Language/zh\_CN ABI/arm64
* **WebView 原始 UA：**&#x4D;ozilla/5.0 (Linux; Android 15; wv) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/134.0.6998.136 Mobile Safari/537.36
* **微信增加的信息：**&#x58;WEB/1340109 MMWEBSDK/20250201 MMWEBID/9925 MicroMessenger/8.0.58.2841(0x28003A3E) WeChat/arm64 Weixin NetType/WIFI Language/zh\_CN ABI/arm64

***

## **接入方式**

## WebAR SDK 方式接入

Android：<https://github.com/kivisense/android-webar-sdk>

iOS：<https://github.com/kivisense/ios-webar-sdk>

### 系统 WebView 方式接入

Coming Soon

开发者也可以接入第三方浏览器内核，如 [腾讯 X5 内核](https://x5.tencent.com/)

### 浏览器组件方式接入

iOS: [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller)

Android：[Chrome Custom Tabs](https://developer.chrome.com/docs/android/custom-tabs/)

***

## 自定义网页开发

使用 Kivicube Web 版 AR 插件进行自定义开发

{% content-ref url="/pages/aTDRb9wLh7u5TMUKUyJh" %}
[Web版AR插件快速接入](/dev/web-dev-1/web-ar-plugin-quick-start.md)
{% endcontent-ref %}


---

# 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://docs-en.kivicube.com/dev/app-dev-2.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.
