---
name: "getAppInfo"
mode: "kit"
versionRequirements:
  - { name: "BizKit", version: "3.0.0" }
  - { name: "@ray-js/ray", version: "0.3.23" }
platform:
  - "iOS"
  - "Android"
async: true
title: "getAppInfo - 拿到当前 App 的业务信息"
---

## getAppInfo

> [VERSION] BizKit >= 3.0.0 | @ray-js/ray >= 0.3.23

> [PLATFORM] iOS, Android

> ⚡ **支持 Promise 调用** — 不传 success / fail / complete 回调时，该方法返回 Promise。

### 描述

拿到当前App的业务信息

### 参数

| 属性 | 类型 | 必填 | 默认值 | 描述 |
| --- | --- | --- | --- | --- |
| `complete` | `() => void` | 否 | - | 接口调用结束的回调函数（调用成功、失败都会执行） |
| `success` | `(params: Object) => void` ↓见下方 | 否 | - | 接口调用成功的回调函数 |
| `fail` | `(params: Object) => void` ↓见下方 | 否 | - | 接口调用失败的回调函数 |

#### success 回调参数

| 属性 | 类型 | 最低版本 | 描述 |
| --- | --- | --- | --- |
| `serverTimestamp` | `number` | `3.1.2` | serverTimestamp 云端时间戳 |
| `appVersion` | `string` | `3.1.2` | appVersion app版本 |
| `language` | `string` | `3.1.2` | language app语言包 |
| `countryCode` | `string` | `3.1.2` | 国家码，返回国家或地区电话区号字符串 返回示例：countryCode: "86"（中国大陆） |
| `regionCode` | `string` | `3.1.2` | 区域服务码，取值来自当前网络区域或用户域配置 在 RN API 中对应 service 字段 返回示例：regionCode: "AY"（中国区） |
| `appName` | `string` | `3.1.2` | appName app名称 |
| `appIcon` | `string` | `3.1.2` | appIcon app图标 |
| `appEnv` | `number` | `3.1.2` | app环境 0: 日常 1: 预发 2: 线上 |
| `appBundleId` | `string` | `3.1.2` | app包名 |
| `appScheme` | `string` | `3.1.2` | app scheme |
| `appId` | `string` | `3.2.2` | app id |
| `clientId` | `string` | `4.2.0` | app clientId |
| `accessibilityMode` | `boolean` | `4.27.1` | 是否打开无障碍模式 |

#### fail 回调参数

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `errorMsg` | `string` | 错误信息 |
| `errorCode` | `string \| number` | 错误码 |
| `innerError` | `Object` | 错误扩展 |

##### fail(params).innerError 的属性

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `errorCode` | `string \| number` | 错误扩展码 |
| `errorMsg` | `string` | 错误扩展信息 |


### 示例代码

#### Demo

```tsx
import { getAppInfo } from '@ray-js/ray'

getAppInfo({
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
