目录

LiveViewLockScreenExtensionAbility

LiveViewLockScreenExtensionAbility is the ExtensionAbility component for the visual area of the immersive lock screen live view. It inherits from UIExtensionAbility, and is designed for real-time activity scenarios that require displaying rich content on the lock screen. By inheriting from this class and implementing your app's extension components, you can visually present more data and provide more quick actions directly on the lock screen without requiring the user to unlock the device.

Since: 5.0.0(12)

Constraints

Modules to Import

import { LiveViewLockScreenExtensionAbility } from '@kit.LiveViewKit';

Device behavior differences: This module is supported on phones and tablets, but does not work on other devices.

LiveViewLockScreenExtensionAbility

Lock screen immersive live view extension ability, which inherits from UIExtensionAbility.

Model restriction: The attributes can be used only in the stage model.

System capability: SystemCapability.LiveView.LiveViewService

Device behavior differences: This API is supported on phones and tablets, but does not work on other devices.

Since: 5.0.0(12)

Name Type Read-Only Optional Description
context LiveViewLockScreenExtensionContext No No Context of LiveViewLockScreenExtensionAbility, which inherits from ExtensionContext.

Example

import { LiveViewLockScreenExtensionAbility } from '@kit.LiveViewKit';
import { UIExtensionContentSession, Want } from '@kit.AbilityKit';
import { hilog } from '@kit.PerformanceAnalysisKit';

export default class LiveViewLockScreenExtAbility extends LiveViewLockScreenExtensionAbility {
  onCreate(): void {
    hilog.info(0x0000, 'LiveViewLockScreenTag', 'LiveViewLockScreenExtAbility onCreate begin.');
  }

  onSessionCreate(want: Want, session: UIExtensionContentSession): void {
    hilog.info(0x0000, 'LiveViewLockScreenTag', 'LiveViewLockScreenExtAbility onSessionCreate begin.');
    let param: Record<string, UIExtensionContentSession> = {
      'session': session
    };
    let storage: LocalStorage = new LocalStorage(param);

    // Parse parameters passed in liveViewLocalScreenAbilityParameters.
    const parameters = want?.parameters;
    let words: string = parameters?.['words'] ? parameters?.['words'] as string : 'Hello World!';
    storage.setOrCreate('words', words);

    // Load the lock screen immersive live view page.
    session.loadContent('pages/LiveViewLockScreenPage', storage);
  }
}

Appendix

The following table lists the APIs that LiveViewLockScreenExtensionAbility is not allowed to call.

Kit Module
Ability Kit

@ohos.ability.featureAbility (FeatureAbility Module)

@ohos.ability.particleAbility (ParticleAbility Module)

@ohos.bundle.launcherBundleManager (launcherBundleManager Module)

@ohos.continuation.continuationManager (Continuation/Collaboration Management)

AppGallery Kit privacyManager (Privacy Agreement Management Service)
ArkData

@ohos.data.distributedData (Distributed Data Management)

@ohos.data.distributedDataObject (Distributed Data Object)

@ohos.data.distributedKVStore (Distributed KV Store)

ArkUI @ohos.window (Window)
Audio Kit @ohos.multimedia.audio (Audio Management)
AVSession Kit

@ohos.multimedia.avsession (Media Session Management)

@ohos.multimedia.avCastPicker (AVCastPicker)

Background Tasks Kit

@ohos.backgroundTaskManager (Background Task Management)

@ohos.resourceschedule.backgroundTaskManager (Background Task Management)

@ohos.reminderAgent (Agent-powered Reminder)

@ohos.reminderAgentManager (Agent-powered Reminder)

Basic Services Kit

@ohos.account.appAccount (Application Account Management)

@ohos.account.distributedAccount (Distributed Account Management)

@ohos.account.osAccount (OS Account Management)

@ohos.request (Upload and Download)

@ohos.wallpaper (Wallpaper)

@ohos.pasteboard (Pasteboard)

Calendar Kit @ohos.calendarManager (Calendar Manager)
Camera Kit

@ohos.multimedia.camera (Camera Management)

@ohos.multimedia.cameraPicker (Camera Picker)

Connectivity Kit

@ohos.connectedTag (Active Tags)

@ohos.nfc.cardEmulation (Standard NFC Card Emulation)

@ohos.nfc.controller (Standard NFC)

@ohos.nfc.tag (Standard NFC Tags)

nfctech (Standard NFC Technologies)

tagSession (Standard NFC Tag Session)

Contacts Kit @ohos.contact (Contacts)
Core File Kit @ohos.file.picker (Picker)
Form Kit

@ohos.app.form.formInfo (formInfo)

@ohos.application.formError (formError)

Map Kit sceneMap (Scenario-specific Control)
MDM Kit

@ohos.enterprise.adminManager (Administrator Permission Management)

@ohos.enterprise.deviceInfo (Device Information Management)

Media Kit @ohos.multimedia.media (Media Kit)
Media Library Kit

@ohos.file.sendablePhotoAccessHelper (Album Management Based on a Sendable Object)

@ohos.file.AlbumPickerComponent (AlbumPickerComponent)

@ohos.file.PhotoPickerComponent (PhotoPickerComponent)

@ohos.file.RecentPhotoComponent (RecentPhotoComponent)

@ohos.multimedia.movingphotoview (MovingPhotoView)

@ohos.file.photoAccessHelper (Album Management)

Notification Kit

@ohos.notification (Notification)

@ohos.notificationManager (NotificationManager)

Payment Kit paymentService (HarmonyOS Payment Service)
Performance Analysis Kit @ohos.hidebug (HiDebug)
Scan Kit

customScan (Barcode Scanning by Custom UI)

detectBarcode (Recognizing Barcodes in an Image)

generateBarcode (Barcode Image Generation)

scanBarcode (Scanning Barcodes Using the Default UI)

scanCore (Common Barcode Scanning Information)

Sensor Service Kit @ohos.vibrator (Vibrator)
Service Collaboration Kit

devicePicker (Device Selection Controller)

CollaborationDevicePicker (Hopping Control)

Share Kit

systemShare (System Share)

harmonyShare (Huawei Share)

Telephony Kit

@ohos.telephony.call (Call)

@ohos.telephony.data (Cellular Data)

@ohos.telephony.observer (observer)

@ohos.telephony.radio (Network Search)

@ohos.telephony.sim (SIM Management)

@ohos.telephony.sms (SMS)

User Authentication Kit @ohos.userIAM.userAuth (User Authentication)
Vision Kit

CardRecognition (Card Recognition Control)

DocumentScanner (Document Scanning Control)