目录

Registering and Managing One-Tap Services for Calendar Events

Use Cases

Calendar Kit provides one-tap services for calendar events, such as joining a meeting, watching a TV series, shopping, and viewing content. After a one-tap service is registered for a calendar event, users can tap the corresponding button to open the configured link and directly access the service page.

Adding a One-Tap Service Event on the Client

After the one-tap service is successfully registered, the system calendar redirection link is configured (the corresponding function button can be displayed on the system calendar page). To implement the one-tap service experience, you need to perform related configurations on the client.

configure the obfuscation scripts as follows:

  1. In the module.json5 file, configure related fields.

    The "exported" field must be set to true.

    Configure the actions field in skills. The actions field indicates the set of action values that can be received. The value is usually a predefined action value in the system, but can also be customized. The actions field cannot be empty. If it is empty, the target party matching will fail. For details about common action values, see Action Constant Description.

    Finally, you need to configure the "uris" field, which must match the link template used during registration.

    For example, if the URI template link entered during server registration is "demo://mobile/player?params=", the content before the equal sign (=) is forcibly verified, and the content after the equal sign (=) is the list of parameters required by the service. You can specify the parameters based on the actual service requirements when using the calendar service to write a schedule. The parameter list cannot directly contain the equal sign (=) or ampersand (&). You are advised to use decodeURI() or encodeURI() to convert the characters.

    {
      "module": {
        "name": "xxx",
        "type": "xxx",
        // ...
        "abilities": [
          {
            "name": "xxxxxxx",
            // ...
            "exported": true,
            "skills": [
              {
                // ...
               "actions": [
                 "ohos.want.action.viewData"
                ],
                "uris": [
                  {
                    "scheme":"demo",
                    "host":"mobile",
                    "pathStartWith": "player"
                  }
                ],
              }
            ]
          }
        ],
      }
    }
  2. The want object in the onCreate and onNewWant APIs of the launched landing page EntryAbility contains the corresponding launch information. You can implement the redirection logic using the corresponding parameters.

  3. Call the addEvent API to add event data. Then, you can see an event with the one-tap service button in the calendar. Tap the button to go to the corresponding landing page.

Constraints