DEV Community

HarmonyOS
HarmonyOS

Posted on

[Smart Watch] [API 6] The app icon for the service center is not in the form of small eyelashes.

Read the original article:[Smart Watch] [API 6] The app icon for the service center is not in the form of small eyelashes.

Question:

The app icon for the service center is not in the form of small eyelashes, but rather the same as the desktop app icons. How can I set a separate icon for it to make its icon in the form of small eyelashes in the service center?

Here is target service center app icon example with eyelashes:

2ecce8d49c19b88a91e98174e96bd094_440x258.png

Solution:

By default, the service card project uses MainAbility for service cards, which inherits the main application icon. To set a separate icon in the small eyelash style, you can add a dedicated Ability for service cards and define the corresponding icon in the desired format.

Steps to implement the solution:

  1. Define a dedicated Ability for the service card:
    Add a new ability (in this example it is named WidgetAbility) and assign the appropriate small eyelash-style icon to it.

  2. Configure the module:
    Modify your module to include both the main ability and the new ability with a separate icon.

  3. Example Configuration:
    Here's a sample configuration that defines both abilities:

   "module": {
     "mainAbility": "com.example.cardtest.WidgetAbility",
     "deviceType": [
       "wearable"
     ],
     "abilities": [
       {
         "skills": [
           {
             "entities": [
               "entity.system.home"
             ],
             "actions": [
               "action.system.home"
             ]
           }
         ],
         "orientation": "unspecified",
         "visible": true,
         "name": "com.example.cardtest.MainAbility",
         "icon": "$media:icon",
         "description": "$string:mainability_description",
         "label": "$string:entry_MainAbility",
         "type": "page",
         "launchType": "standard"
       },
       {
         "orientation": "unspecified",
         "name": "com.example.cardtest.WidgetAbility",
         "icon": "$media:widgetIcon",
         "description": "$string:widget_ability_description",
         "formsEnabled": true,
         "label": "$string:widget_ability_description",
         "type": "page",
         "forms": [
           {
             "jsComponentName": "widget",
             "isDefault": true,
             "scheduledUpdateTime": "10:30",
             "defaultDimension": "2*2",
             "name": "widget",
             "description": "This is a service widget.",
             "colorMode": "auto",
             "type": "JS",
             "supportDimensions": [
               "2*2"
             ],
             "updateEnabled": true,
             "updateDuration": 1
           }
         ],
         "launchType": "standard"
       }
   ], //... continues
Enter fullscreen mode Exit fullscreen mode

Written by Muaz Kartal

Top comments (0)