We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
GuidesSystemHardwareCar KitDevelopment Preparations

Development Preparations

Before using Car Kit capabilities, you need to configure the build mode, permissions, and capabilities.

Configuring the Build Mode

When packaging an app, click in the upper right corner of DevEco Studio, change the build mode to release, and click Apply in the lower right corner.

Configuring Permissions

Car Kit provides two types of APIs: navigation APIs and mobility connectivity APIs. You need to configure the corresponding permissions for using these APIs.

  • To use navigation APIs, you need to configure the ohos.permission.ACCESS_SERVICE_NAVIGATION_INFO permission.

  • To use mobility connectivity APIs, you need to configure the ohos.permission.ACCESS_CAR_DISTRIBUTED_ENGINE permission.

Configure required permissions in the app configuration file module.json5 in entry/src/main. The sample code is as follows:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. "requestPermissions": [
  4. {
  5. "name": "ohos.permission.ACCESS_CAR_DISTRIBUTED_ENGINE"
  6. },
  7. {
  8. "name": "ohos.permission.ACCESS_SERVICE_NAVIGATION_INFO"
  9. }
  10. ]
  11. }
  12. }

Configuring Capabilities

Configure the navigation hop or HiCar capability in the abilities array of the app configuration file module.json5 in entry/src/main. The procedure is as follows:

  1. Configure the actions of the navigation information service in skills.

    NOTE

    If your app has other skills, do not directly modify the existing configuration. Instead, supplement the configuration in the skills array.

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. "skills": [
    2. {
    3. "entities": [
    4. "entity.system.default"
    5. ],
    6. "actions": [
    7. "action.navigation.infoservice"
    8. ]
    9. },
    10. // Configure other skills.
    11. {
    12. // ...
    13. }
    14. ]
  2. Configure the navigation hop or HiCar capability in metadata. The sample code is as follows:

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. {
    2. "module": {
    3. "abilities": [
    4. {
    5. "name": "xxxx",
    6. "srcEntry": "xxxx",
    7. "description": "xxxx",
    8. "skills": [
    9. {
    10. "entities": [
    11. "entity.system.home"
    12. ],
    13. "actions": [
    14. "action.system.home"
    15. ]
    16. },
    17. {
    18. "entities": [
    19. "entity.system.default"
    20. ],
    21. "actions": [
    22. "action.navigation.infoservice"
    23. ]
    24. }
    25. ],
    26. "metadata": [
    27. {
    28. "name" : "carHopCapability",
    29. "value" : "carHopNavi,getOnCarNavi,insideCarNavi,getOffCarNavi"
    30. },
    31. {
    32. "name" : "hiCarCapability",
    33. "value" :"basicNavi,shortcutOper,multiScreenUI,mapUIOper,updateNaviStatus,searchPOI"
    34. }
    35. ]
    36. }
    37. ]
    38. }
    39. }

The options of name in metadata are carHopCapability and hiCarCapability.

  • If name is set to carHopCapability, the navigation hop capability is supported. Set value according to the service scenarios.

    Expand
    value Scenario
    carHopNavi Tap for navigation hop, which cannot coexist with "tap for address hop."
    carHopAddress Tap for address hop, which cannot coexist with "tap for navigation hop."
    getOnCarNavi Auto navigation hop upon vehicle entry.
    insideCarNavi In-vehicle auto navigation hop.
    getOffCarNavi Hop to walking navigation upon vehicle exit.
  • If name is set to hiCarCapability, the HiCar capability is supported. Set value according to the service scenarios.

    Expand
    value Scenario
    basicNavi

    Basic navigation functions. The corresponding commands are as follows:

    1. START_NAVIGATION

    2. STOP_NAVIGATION

    shortcutOper

    Shortcut operation functions. The corresponding commands are as follows:

    1. GO_HOME

    2. GO_TO_COMPANY

    multiScreenUI

    Multi-screen display functions. The corresponding commands are as follows:

    1. START_MAP_LAYER

    2. STOP_MAP_LAYER

    mapUIOper

    Map UI control functions. The corresponding commands are as follows:

    1. ZOOM_IN_MAP

    2. ZOOM_OUT_MAP

    3. CHANGE_THEME

    updateNaviStatus

    Map status and metadata update. The corresponding commands are as follows:

    1. START_UPDATE_NAVIGATION_STATUS

    2. STOP_UPDATE_NAVIGATION_STATUS

    searchPOI

    Address search. The corresponding command is as follows:

    SEARCH_POI

    For more information about the commands, please refer to CommandType.

Search in Guides
Enter a keyword.