Location>code7788 >text

【FAQ】HarmonyOS SDK closed source open capability —Live View Kit (1)

Popularity:617 ℃/2025-02-20 11:03:37

1. Problem description:

After the client creates a live window, it updates the live window content through the push kit. Is this process automatically updated or is it filled with data to update after the client parsing the push message data? What else does the client need to do besides connecting to the Push kit and creating a live window?

Solution:

The process of updating the content of the live window through Push Kit is automatically updated. After the client creates a local live window, when using Push Kit to obtain the Push Token and calls the relevant API interface, Push Kit will automatically push update messages. Specifically, when the user's service order status changes, Push Kit will send update messages. After the client receives these messages, it will automatically update the live window content.

In addition to connecting to Push Kit and creating an initial live window, the client also needs to ensure the following points:

1. Permission application: You need to apply for relevant permissions for the live window to ensure that the application can create and update the live window when running in the foreground.

2. Instantiate LiveViewManager: The client needs to instantiate LiveViewManager and use its method to update and end the live window.

3. Get Push Token: Make sure that when using Push Kit to update the live window, a valid Push Token has been obtained.

4. Configure Push Kit: You need to configure Push Kit-related parameters in the project configuration file, such as project ID, Authorization, etc.

Through the above steps, the client can automatically update the content of the live window to ensure that users can obtain the latest information in a timely manner.

Reference documentation:

Push live window message:/consumer/cn/doc/harmonyos-guides-V5/push-update-liveview-V5

Build a local live window:/consumer/cn/doc/harmonyos-guides-V5/liveview-create-locally-V5

2. Problem description:

Creating and updating the live window failed. The device has added a whitelist of the push service live window, and the normal message client with type=0 can be successfully received.

Solution:

Create a live window and check it here. The receipt status code: 265, status code description: The live window notification update is controlled. Cause and processing: The live window notification corresponding to the sent activityId does not exist, and the live window notification message of the activityId is limited to 24 hours of sending.

Because I used this activityId to update the live window, but in fact, this live window notification does not exist, resulting in the activityId being limited to 24 hours. You can no longer use this activityId to create or update the live window within 24 hours. It is recommended to use a new activityId to re- create.

The update live window is inquired that the device is offline, which may be due to a network problem or a mobile phone shutdown. It is recommended to determine the ability to successfully create the live window before calling the updated interface.

Please also confirm:

1. Create a live window through Push Kit. Live window messages support three types of operation, namely FLIGHT, TAXI, and TRAIN. Only flights, travel taxi, high-speed rail/train scenarios support creating a live window through Push Kit. For other scenarios, please use Live View. Kit is created locally.

2. To ensure that the application can receive messages normally, it is recommended that the application call the requestEnableNotification() method to pop up a reminder before sending a notification, informing the user that it needs to allow the notification message to be received. For details, please refer to the Notification Kit request notification authorization:/consumer/cn/doc/harmonyos-guides-V5/notification-enable-V5

3. Problem description:

StartLiveView# PublishNotification error, code is 67108900

Solution:

The reason for this is that the application () has not enabled the live window permission.

/consumer/cn/doc/harmonyos-guides-V5/liveview-preparations-V5#section42051837114111

4. Problem description:

Is there any situation where the window liveview is created at one time? Will the underlying layer limit the number of windows?

Solution:

1. layoutData is required when creating, and if it is updated or ended, it is not required;

/consumer/cn/doc/harmonyos-references-V5/liveveiw-liveviewmanager-V5#section452772611408

2. There is no limit on the number of live windows created for the time being, but each live window has the ID of the live window. Multiple live windows cannot use the same ID:

/consumer/cn/doc/harmonyos-references-V5/liveveiw-liveviewmanager-V5#section411410371767