Skip to main content
Version: v1.0

The configuration of watchface

The app.json file in the root of the Mini Program provides global configuration of the Mini Program.

Configuration items

PropertiesTypeRequiredDescriptionMinimum Version
configVersionstringYESConfiguration file version number, supports the following values: v1 deprecated, v2 currently used.-
appobjectYESMini Program configuration information.-
runtimeobjectYESMini Program runtime settings.-
permissionsArray<string>YESList of Mini Program permissions.-
targetsobjectYESBuild Mini Program installer setup.-
i18nobjectYESMini Program internationalization configuration.-
defaultLanguagestringYESThe default language setting for the Mini Program. This value is used as the language of the program when the system cannot find a suitable language to set the program. This value is not recommended to be empty.-
debugbooleanNOMini Program debugging function, supports the following values: true Enable debugging function; false Default value. Turn off the debugging function.-

configVersion

configVersion is the version of the JSON file and is used for parsing distinctions. The format is lowercase v + a number, e.g., v1, v2.

Examples are as follows:

{
"configVersion": "v2"
}

app

app indicates program configuration information.

PropertiesTypeRequiredDescriptionMinimum Version
appIdnumberYESThe Mini Program "id", "id" is the unique identification of the Mini Program.v2
appNamestringYESMini Program Name.v2
appTypestringYESMini Program type. The following values are supported: app Mini Program; watchface dial.v2
versionobjectYESMini Program version information.v2
iconstringNOThe path to the Mini Program icon. Reference Design Specifications - app icons. If not passed, use the default icon.v2
venderstringYESDeveloper Name.v2
venderIdnumberNODeveloper id.-
coverArray<string>NOMatching images for Mini Program display. In general, dials are used.-
descriptionstringYESShort description of the Mini Program.v2

version: object

version indicates the version information of the Mini Program.

PropertiesTypeRequiredDescriptionMinimum Version
codenumberYESMini Program program version number. The default starts from 1. Note: Each version should be larger than the previous one. For example: 12, 13, 2001, etc.-
namestringYESSemantic version of the Mini Program. It is recommended that versions be recorded in the format x.x.x. For example: 1.0.1.-

Examples are as follows:

{
"app": {
"appId": 1000089,
"appName": "······",
"appType": "app",
"version": {
"code": 5,
"name": "0.0.5"
},
"icon": "logo.png",
"vender": "······",
"description": "······"
}
}

runtime: object

runtime indicates the Mini Program runtime configuration.

PropertiesTypeRequiredDescriptionMinimum Version
apiVersionobjectYESRuntime API Versions.v2
typenumberNOThe loader type for loading Mini Programs at runtime, supporting the following values: 0 Current value YES Default value. It indicates that the Mini Program is loaded with the loader of the QuickJS-js interpreter, with the suffix .js, 1 indicates that the Mini Program is loaded with the loader of the C interpreter, with the suffix .c, 2 indicates that the Mini Program is loaded with the loader of the QuickJS-bytecode interpreter, with the suffix .binv2

apiVersion: object

apiVersion indicates API version information, Minimum Version, Target Version, Adopted Version, etc.

When the APP-side Mini Program installs or upgrades the device-side Mini Program via Bluetooth, you need to get the JS-SDK version number of the device-side Mini Program, and then further compare it with this field.

PropertiesTypeRequiredDescriptionMinimum Version
minVersionstringYESRuntime requirements, this field YES is required to determine the current runtime requirements of the Mini Program; v <= minVersion, cannot be upgraded or installed.v2
compatiblestringNOCompatible version, optional.v2
targetstringNOThis is the version of the target SDK, runtime, optionally.v2

Examples are as follows:

{
"runtime": {
"apiVersion": {
"compatible": "1.0.0",
"target": "1.0.1",
"minVersion": "1.0.0"
}
"type": "0"
}
}

permissions: Array

permissions indicates a list of permissions, if the user applies for a permission that is not in the list, the application is invalid, permissions supports dynamic application of permissions.

{
"permissions": []
}

targets: object

The targets allow you to distinguish between devices to pass in different build configurations.

caution

The key name of the targets object is the name of the subdirectory in the /assets directory, which needs to be consistent, see directory structure.

PropertiesTypeRequiredDescriptionMinimum Version
moduleobjectYESMini Program function module configuration.v2
platformsArray<object>YESMini Program running platform device selection.v2
designWidthnumberYESThe design width of the current view, adjusted using the px runtime; this value depends on the design draftsv2

As the latest known device names are as follows:

{
"targets": {
"gtr-3-pro": {
"module": {
// ...
}
},
"gtr-3": {
"module": {
// ...
}
},
"gts-3": {
"module": {
// ...
}
},
}
}

module: object

PropertiesTypeRequiredDescriptionMinimum Version
shortcutobjectNO, only valid if appType is app.The description of jumping to the Mini Program.v2
pageobjectYES, required when appType is app.The configuration of page in Device App module .v2
app-widgetobjectNOThe configuration of Shortcut Cards.v2
secondary-widgetobjectNOThe configuration of SecondaryWidget.v2
watch-widgetobjectNOThe configuration of watchface component module.v2
watchfaceobjectYES, required when appType is watchface.The configuration of watchface module.v2
app-sideobjectNOThe configuration of companion module.v2
settingobjectNOThe configuration of Settings App module.v2

Examples are as follows:

{
"module": {
"page": {
"pages": ["page/gtr-3-pro/loading"]
},
"app-side": {
"path": "app-side/index"
},
"setting": {
"path": "setting/index"
},
"app-widget": {
"widgets": [
{
"path": "app-widget/index",
"icon": "icon.png",
"name": "app-widget-demo",
"runtime": {
"type": "js"
}
}
]
}
}
}

shortcut: object

shortcut indicates the description of jumping to the Mini Program. This attribute is mutually exclusive with the page attribute and will not exist together in a package.

PropertiesTypeRequiredDescriptionMinimum Version
schemestringYESProtocol type: Support type dapp.v2
appLangTypenumberYESJump to target Mini Program type: 0: js Mini Program; 1: native app.v2
appIdnumberRequired if appLangType is js.The appid of the Mini Program.v2
pathstringYESFile's path/native app's name.v2
paramsstringNOThe parameters for jumping.v2

page: object

page indicates the configuration of page in Device App module. This attribute is mutually exclusive with the shortcut attribute and will not exist in a package.

PropertiesTypeRequiredDescriptionMinimum Version
pagesArray<string>YESPage path, at least one; the default is the first Mini Program entrance.v2

app-widget: object

The app-widget represents a third-party App component.

PropertiesTypeRequiredDescriptionMinimum Version
widgetsArray<string>YESComponent path, can be none.v2

watch-widget: object

watch-widget represents the watchface component.

PropertiesTypeRequiredDescriptionMinimum Version
widgetsArray<string>YESComponent path, can be none.v2

watchface: object

watchface represents the watchface.

PropertiesTypeRequiredDescriptionMinimum Version
pathstringYESThe path of watchface.v2
mainnumberNO(If you don't add it, the default is 1.)The watchface which displays in home page.(0:none)v2
editablenumberNO(If you don't add it, the default is 0.)Editable watchface (0: not supported)v2
lockscreennumberNO(If you don't add it, the default is 0.)Lock screen(0:none)v2
photoscreennumberNO(If you don't add it, the default is 0.)Photo watchface (0: not supported)v2

app-side: object

app-side represents a Side Service.

PropertiesTypeRequiredDescriptionMinimum Version
pathstringNOThe path of Side Service.v2

setting: object

setting represents the page of Settings App.

PropertiesTypeRequiredDescriptionMinimum Version
pathstringYESThe path of Settings App.v2

platforms: object

platforms indicates the target platform selection. Need to follow the developer to choose the type: target.platforms specification to take the value specification.

The value reference of deviceSource List of ZeppOS-enabled Devices

PropertiesTypeRequiredDescriptionMinimum Version
namestringNODevice description, named by the developer.v2
deviceSourcenumberYESNumber of the equipment.v2

Examples are as follows:

{
"platforms": [{
"name": "gts-3",
"deviceSource": 229
}, {
"name": "gts-3",
"deviceSource": 230
}]
}

designWidth

designWidth indicates the design width, provided to the global px function as the size calculation base, refer to Screen Adaptation.

{
"designWidth": 390
}

i18n: object

The i18n role is to configure multilingual processing.

The abbreviations of the corresponding codes for each country region, refer to Multilingual Mapping.

Examples are as follows:

{
"i18n": {
"en-US": {
"appName": "······"
},
"en-ES": {
"appName": "······"
}
}
}

defaultLanguage: string

Examples are as follows:

{
"defaultLanguage": "zh-cn"
}

Complete app.json example

Take the app.json of the sample application Calories as an example:

caution

This example only configures deviceSource for Amazfit GTR 3 Pro, Amazfit GTR 3 and Amazfit GTS 3 devices.

If you want to support the rest of the devices, please refer to the configuration of the targets field and add them yourself.

{
"configVersion": "v2",
"app": {
"appId": 1000000,
"appName": "Calories",
"appType": "app",
"version": {
"code": 1,
"name": "1.0.0"
},
"icon": "icon.png",
"vender": "huami",
"description": ""
},
"permissions": [],
"runtime": {
"apiVersion": {
"compatible": "1.0.0",
"target": "1.0.1",
"minVersion": "1.0.0"
}
},
"targets": {
"gtr-3-pro": {
"module": {
"page": {
"pages": [
"page/gtr-3/index",
"page/gtr-3/foodList"
]
}
},
"platforms": [{
"name": "gtr3pro",
"deviceSource": 229
}, {
"name": "gtr3pro",
"deviceSource": 230
}],
"designWidth": 480
},
"gtr-3": {
"module": {
"page": {
"pages": [
"page/gtr-3/index",
"page/gtr-3/foodList"
]
}
},
"platforms": [{
"name": "gtr3",
"deviceSource": 226
}, {
"name": "gtr3",
"deviceSource": 227
}],
"designWidth": 480
},
"gts-3": {
"module": {
"page": {
"pages": [
"page/gts-3/index",
"page/gts-3/foodList"
]
}
},
"platforms": [{
"name": "gts3",
"deviceSource": 224
}, {
"name": "gts3",
"deviceSource": 225
}],
"designWidth": 390
}
},
"i18n": {
"zh-CN": {
"appName": "卡路里"
},
"ar-EG": {
"appName": "السعرات الحرارية"
},
"ca-ES": {
"appName": "Calories"
},
"cs": {
"appName": "Kalorie"
},
"da-DK": {
"appName": "Kalorier"
},
"de-DE": {
"appName": "Kalorien"
},
"el": {
"appName": "Θερμίδες"
},
"en-US": {
"appName": "Calories"
},
"es-ES": {
"appName": "Calorías"
},
"fi": {
"appName": "Kalorit"
},
"fr-FR": {
"appName": "Calories"
},
"he": {
"appName": "קלוריות"
},
"hi": {
"appName": "कैलोरी"
},
"hu-HU": {
"appName": "Kalória"
},
"id-ID": {
"appName": "Kalori"
},
"it-IT": {
"appName": "Calorie"
},
"ja-JP": {
"appName": "カロリー"
},
"ko-KR": {
"appName": "칼로리"
},
"mr": {
"appName": "कॅलरीज"
},
"nb-NO": {
"appName": "Kalorier"
},
"nl": {
"appName": "Calorieën"
},
"pl-PL": {
"appName": "Kalorie"
},
"pt": {
"appName": "Calorias"
},
"pt-BR": {
"appName": "Calorias"
},
"ro": {
"appName": "Calorii"
},
"ru-RU": {
"appName": "Калории"
},
"sk": {
"appName": "Kalórie"
},
"sr": {
"appName": "Калорије"
},
"sv-SE": {
"appName": "Kalorier"
},
"th-TH": {
"appName": "แคลอรี"
},
"tr-TR": {
"appName": "Kalori"
},
"uk": {
"appName": "Калорії"
},
"vi": {
"appName": "Calo"
},
"zh-TW": {
"appName": "卡路里"
}
},
"defaultLanguage": "en-US"
}