1.布局
运行后现在只是一个静态页面,功能后面再实现
2.权限开放
正如上图,我们需要用到设备的一些权限,这些权限需要打开菜鸟使用对应的功能
在config.json同一级目录下添加下面的代码
"reqPermissions": [ {"name": "ohos.permission.DISTRIBUTED_DATASYNC"}, {"name": "ohos.permission.servicebus.ACCESS_SERVICE"}, {"name": "ohos.permission.ACCESS_HW_ASSETSTORE_SERVICE"}, {"name": "ohos.huawei.hwddmp.servicebus.BIND_SERVICE"}, {"name": "ohos.permission.DISTRIBUTE_SERVICE"}, {"name": "ohos.permission.GET_BUNDLE_INFO"}, {"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"} ],
再在ManinAbility添加下面的代码。
requestPermissionsFromUser(new String[]{ "ohos.permission.DISTRIBUTED_DATASYNC", "ohos.permission.servicebus.ACCESS_SERVICE", "ohos.huawei.hwddmp.servicebus.BIND_SERVICE" },0);