manifest 文件

更新时间:

manifest.json 文件中包含了应用描述、接口声明、页面路由信息

manifest

属性 类型 默认值 必填 描述
package String - 应用包名,确认与原生应用的包名不一致,推荐采用 com.company.module 的格式,如:com.example.demo
name String - 应用名称,6 个汉字以内,与应用商店保存的名称一致,用于在桌面图标、弹窗等处显示应用名称
icon String - 应用图标,提供 114x114 大小的即可
versionName String - 应用版本名称,如:"1.0"
versionCode Integer - 应用版本号,从1自增,推荐每次重新上传包时versionCode+1
features Array - 接口列表,绝大部分接口都需要在这里声明,否则不能调用,详见每个接口的文档说明
config Object - 系统配置信息,详见下面说明
router Object - 路由信息,详见下面说明
deviceTypeList Array<String> watch 可选值有:watch, watch-square, watch-round, tv , car, phone
display Object - UI 显示相关配置,详见下面说明
permissions Array - 权限申请示例:[{ "name": "watch.permission.LOCATION" }]
appCategory Array<String> - 应用类别,可选值详见下文应用类别说明,最多 2 个分类

应用类别说明 appCategory

注:appCategory 属性要求开发者必填,如有开发者未填,系统将设置为['other']。

类别 说明
business 商业类应用
education 教育类应用
pastime 娱乐类应用
finance 财务类应用
games 游戏类应用
lifestyle 生活方式类应用
medical 医疗类应用
music 音乐类应用
news 新闻类应用
photography 摄影类应用
reference 参考资料类应用
social 社交类应用
sports 体育类应用
travel 旅游类应用
utilities 实用工具类应用
video 视频类应用
weather 天气类应用
navigation 导航类应用
book 书籍类应用
shopping 购物类应用
podcasts 播客类应用
audiobooks 音频书籍类应用
radio 电台类应用
other 其它类应用

config

用于定义系统配置和全局数据。

属性 类型 默认值 描述
designWidth Integer - 页面设计基准宽度,根据实际设备宽度来缩放元素大小,建议使用 466

router

用于定义页面的组成和相关配置信息,如果页面没有配置路由信息,则在编译打包时跳过。

属性 类型 默认值 必填 描述
entry String - 首页名称
pages Object - 页面配置列表,key 值为页面名称(对应页面目录名,例如 Hello 对应'Hello'目录),value 为页面详细配置 page,详见下面说明

示例代码:

{
  "router": {
    "entry": "Demo",
    "errorPage": "ErrorPage",
    "pages": {
      "Demo": {
        "component": "index"
      },
      "ErrorPage": {
        "component": "index"
      }
    }
  }
}
复制代码

router.pages

用于定义单个页面路由信息。

属性 类型 默认值 必填 描述
component String - 页面对应的组件名,与 ux 文件名保持一致,例如'hello' 对应 'hello.ux',目前仅支持 index.ux
path String /<页面名称> 页面路径,例如“/user”,不填则默认为/<页面名称>。
path 必须唯一,不能和其他 page 的 path 相同。
下面 page 的 path 因为缺失,会被设置为“/Index”:
"Index": {"component": "index"}
launchMode String standard 声明页面的启动模式,支持"singleTask","standard"两种页面启动模式。
标识为"singleTask"模式时每次打开目标页面都会打开已有的目标页面并回调 onRefresh 生命周期函数,清除该页面上打开的其他页面,没有打开过此页面时会创建新的目标页面实例。
标识为"standard"模式时会每次打开新的目标页面(多次打开目标页面地址时会存在多个相同页面)
followHand String enable 配置页面是否支持右滑跟手,disable:不支持;enable:支持

display

用于定义与 UI 显示相关的配置。

如果在 display 对象下定义以下属性值,则生效范围为此蓝河应用全部页面;

属性 类型 默认值 描述
backgroundColor String #000 窗口背景颜色

权限列表说明

权限名 需要导入的模块 需要权限申请的具体接口 说明 权限错误码
watch.permission.LOCATION import geolocation from '@blueos.hardware.geolocation' geolocation.getLocation(OBJECT)
geolocation.subscribe(OBJECT)
geolocation.unsubscribe()
位置信息 400 : 拒绝授予权限, 402: 权限错误(未声明该权限)
watch.permission.STEP_COUNTER import sensor from '@blueos.hardware.sensor' sensor.subscribeStepCounter(OBJECT) 计步传感器 400 : 拒绝授予权限, 402: 权限错误(未声明该权限)
watch.permission.DEVICE_INFO import device from '@blueos.hardware.device' device.getId(OBJECT)
device.getDeviceId(OBJECT)
device.getSerial(OBJECT)
设备信息 400: 拒绝授予权限 , 402: 权限错误(未声明该权限)
watch.permission.RECORD import record from '@blueos.multimedia.record' record.start(OBJECT)
record.stop(OBJECT)
record.release(OBJECT)
录音 400: 拒绝授予权限, 401: 敏感权限不能在后台运行, 402: 权限错误(未声明该权限)
watch.permission.BLUETOOTH import bluetooth from '@blueos.communication.bluetooth.bluetooth'
import bluetooth from '@vivo.bluetooth'
bluetooth.getBindState()
bluetooth.startBind(OBJECT)
bluetooth.confirmBind(OBJECT)
bluetooth.cancelBind(OBJECT)
bluetooth.startDevicesDiscovery(OBJECT)
bluetooth.onDevicefound = function(data)
bluetooth.stopDevicesDiscovery(OBJECT)
bluetooth.getConnectedDevices(OBJECT)
bluetooth.getPairedDevices(OBJECT)
bluetooth.createConnection(OBJECT)
bluetooth.closeConnection (OBJECT)
bluetooth.pair(OBJECT)
bluetooth.unpair(OBJECT)
bluetooth.subscribeBind(OBJECT)
bluetooth.clearBindData(OBJECT)
bluetooth.replyPhone(OBJECT)
bluetooth.onadapterstatechange = function(data)
允许使用设备蓝牙 400 : 拒绝授予权限, 402: 权限错误(未声明该权限)
watch.permission.READ_HEALTH_DATA import health from '@blueos.health.health'
import health from '@vivo.health'
health.getRecentSamples(Object)
health.subscribeSample(Object)
health.unsubscribeSample(Object)
health.getTodayStatistic(Object)
health.subscribeTodayStatistic(Object)
health.unsubscribeTodayStatistic(Object)
读取健康数据 400 : 拒绝授予权限, 402: 权限错误(未声明该权限)
上一篇
文件组织
下一篇
ux文件
以上内容对您是否有帮助?
  • 毫无帮助
  • 帮助不大
  • 一般
  • 很好
  • 非常好
意见反馈