阅读(921) (0)

鸿蒙OS 配置文件示例

2020-09-15 09:25:02 更新

以 JSON 文件为 config.json 的一个简单示例,该示例的应用声明为三个 Ability。

{
    "app": {
        "bundleName": "com.huawei.hiworld.himusic",
        "vendor": "huawei",
        "version": {
            "code": 2, 
            "name": "2.0"
        }
        "apiVersion": {
            "compatible": 3, 
            "target": 3
        }
    },
    "deviceConfig": {
        "default": {
        }
    },
    "module": {
        "package": "com.huawei.hiworld.himusic.entry",
        "name": ".MainApplication",
        "supportedModes": [
            "drive"
        ],
        "distro": {
            "moduleType": "entry",
            "deliveryWithInstall": true,
            "moduleName": "hap-car"
        },
        "deviceType": [
            "car"
        ],

 
        "abilities": [
            {
                "name": ".MainAbility",
                "description": "himusic main ability",
                "icon": "$media:ic_launcher",
                "label": "HiMusic",
                "launchType": "standard",
                "orientation": "unspecified",
                "visible": true,
                "skills": [
                    {
                        "actions": [
                            "action.system.home"
                        ],
                        "entities": [
                            "entity.system.home"
                        ]
                    }
                ],
                "type": "page",
                "formEnabled": false
            },
            {
                "name": ".PlayService",
                "description": "himusic play ability",
                "icon": "$media:ic_launcher",
                "label": "HiMusic",
                "launchType": "standard",
                "orientation": "unspecified",
                "visible": false,
                "skills": [
                    {
                        "actions": [
                            "action.play.music",
                            "action.stop.music"
                        ],
                        "entities": [
                            "entity.audio"
                        ]
                    }
                ],
                "type": "service",
                "formEnabled": false,
                "backgroundModes": [
                    "audioPlayback"
                ]
            },
            {
                "name": ".UserADataAbility",
                "type": "data",
                "uri": "dataability://com.huawei.hiworld.himusic.UserADataAbility",
                "visible": true
            }
        ],
        "reqPermissions": [{
                "name": "ohos.permission.DISTRIBUTED_DATASYNC",
                "reason": "",
                "usedScene": {
                    "ability": [
                        "com.huawei.hiworld.himusic.entry.MainAbility",
                        "com.huawei.hiworld.himusic.entry.PlayService"
                    ],
                    "when": "inuse"
                }
            }
        ]
    }
}