diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..1e0e475b8fa2f3378e73ca651ad2ecd5f63f70cf --- /dev/null +++ b/README.en.md @@ -0,0 +1,74 @@ +# Lock Screen Immersive Live Views + +## Overview + +Based on HarmonyOS, Live View Kit allows you to create, update, and close live view in multiple scenarios, such as instant delivery. Customized status nodes are provided for different scenarios to help users focus on key information and improve user experience. Through the Live View Kit, lock screen immersive live views provide users with real-time access to essential application activity details directly on the lock screen, eliminating the need to unlock their device and enter the application. These live views are especially suitable for scenarios with high real-time requirements, where users need to stay updated on the current status. + +## Concepts + +- Live view: Live views help users focus on ongoing tasks, facilitating quick viewing and instant processing of these tasks. Live view messages feature a specific period, timeliness, and updates. + +## Preview + +Lock Screen: + +![image](screenshots/phone_lock_screen.en.png) + +## How to Use + +1. After the application is started, the live view and immersive live view are automatically activated. The home page does not have specific functionalities and is only for display purposes. + +2. After swiping up to go back to the home page, a user can swipe down the notification panel or tap the live view capsule on the left side of the page navigation bar to check message notifications and all live view pages. + +3. Turn on the lock screen and tap the lock screen button again to view the lock screen immersive live views. + +4. This sample provides only the capabilities of creating, updating, and ending a live view locally. (The live view cannot be updated in the background. To update it in the background, use Push Kit.) If you want to use Push Kit for update, you can use an existing server to call the corresponding REST API. For details, see [Service for pushing live view messages](https://developer.huawei.com/consumer/en/doc/harmonyos-guides/push-update-liveview). + +## Project Directory + +``` +├─entry/src/main/ets +│ ├───constant +│ │ └───Constant.ets // Constant +│ ├───entryability +│ │ └───EntryAbility.ets // EntryAbility +│ ├───liveview +│ │ ├───LiveViewExtAbility.ets // Live view +│ │ └───LockScreenPage.ets // Lock screen page +│ ├───model +│ │ └───RouteDataModel.ets // Navigation data model +│ ├───pages +│ │ └───Index.ets // Home page +│ ├───utils +│ │ ├───BreakpointUtil.ets // Breakpoint utility +│ │ ├───LiveView.ets // Live view class +│ │ └───LiveViewUtil.ets // Live view utility +│ ├───view +│ │ ├───RoadView.ets // Road +│ │ ├───TrafficInfoView.ets // Navigation information +│ │ └───TrafficView.ets // Navigation page +│ └───viewmodel +│ └───RouteDataViewModel.ets // Navigation data ViewModel +└───entry/src/main/resources +``` + +## How to Implement + +1. After the **HomePage** is created, create a live view and a scheduled task. The **liveViewManager.updateLiveView()** API is called at fixed intervals to update the live view, and the **commonEventManager.publish()** API is used to pass new parameters to the immersive live view page, so as to realize the update of the live view and the immersive live view. + +## Required Permissions + +1. To use this instance, replace **bundleName** in the **AppScope/app.json5** file with your bundle name. + + ![img.png](screenshots/img.png) + +2. If your own bundle name has not applied for the permissions of live view and immersive live view, please refer to the [development preparations of Live View Kit](https://developer.huawei.com/consumer/en/doc/harmonyos-guides/liveview-preparations) and first activate the permissions of push service and live view. + +3. **ohos.permission.KEEP_BACKGROUND_RUNNING**: Obtains the permission to run the application in the background. + +## Constraints + +1. This sample is only supported on Huawei phones running standard systems. +2. The HarmonyOS version must be HarmonyOS 5.0.5 Release or later. +3. The DevEco Studio version must be DevEco Studio 5.0.5 Release or later. +4. The HarmonyOS SDK version must be HarmonyOS 5.0.5 Release SDK or later. \ No newline at end of file diff --git a/README.md b/README.md index 0b0ac6703d96e2731e3824df56f6c0d7b8005e64..fe29cf8427a20e70642cb66d9cbd210c4438e28c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ 锁屏界面: -![](screenshots/phone_lock_screen.png) +![image](screenshots/phone_lock_screen.png) ## 使用说明 @@ -51,7 +51,6 @@ │ └───viewmodel │ └───RouteDataViewModel.ets // 导航数据ViewModel └───entry/src/main/resources - ``` ## 具体实现 @@ -61,6 +60,7 @@ ## 相关权限 1. 若您需要使用本实例,请替换AppScope/app.json5文件内的bundleName为您的包名。 + ![img.png](screenshots/img.png) 2. 若您自己的包名未申请实况窗与沉浸实况窗权益,请参考[Live View Kit(实况窗服务)开发准备](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/liveview-preparations),先开通推送服务权益与实况窗权益。 diff --git a/screenshots/img.png b/screenshots/img.png index 5834cf20dbcfe527e425c3a63879bd3f2741dc73..72be66c41db8a6f06452e408691f9c74435fca5c 100644 Binary files a/screenshots/img.png and b/screenshots/img.png differ diff --git a/screenshots/phone_lock_screen.en.png b/screenshots/phone_lock_screen.en.png new file mode 100644 index 0000000000000000000000000000000000000000..f3bf08a227911ee204bf476875e262dc0e8ecd10 Binary files /dev/null and b/screenshots/phone_lock_screen.en.png differ