StatusBarViewExtensionAbility is a status bar extension ability inherited from UIExtensionAbility. It is used to provide apps with the capability of accessing the pop-up window displayed when users left-click an app icon in the status bar.
The APIs of this module can be used only in the stage model.
System capability: SystemCapability.PCService.StatusBarManager
Since: 5.0.0(12)
import { StatusBarViewExtensionAbility } from '@kit.DeskTopExtensionKit'; Example:
import { StatusBarViewExtensionAbility } from '@kit.DeskTopExtensionKit';
import { UIExtensionContentSession, Want } from '@kit.AbilityKit';
let TAG = "MyStatusBarViewAbility";
export default class MyStatusBarViewAbility extends StatusBarViewExtensionAbility {
// Called when a StatusBarViewExtensionAbility instance is created.
onCreate() {
console.info(TAG, `onCreate`);
}
// Called when a UIExtensionContentSession instance is created.
onSessionCreate(want: Want, session: UIExtensionContentSession) {
console.info(TAG, `onSessionCreate, want: ${JSON.stringify(want)}`);
session.loadContent('pages/StatusBarPage');
}
// Called when a StatusBarViewExtensionAbility component is initially launched into the foreground or transitions from the background to the foreground.
onForeground() {
console.info(TAG, `onForeground`);
}
// Called when a StatusBarViewExtensionAbility component transitions from the foreground to the background.
onBackground() {
console.info(TAG, `onBackground`);
}
// Called when a UIExtensionContentSession instance is destroyed.
onSessionDestroy(session: UIExtensionContentSession) {
console.info(TAG, `onSessionDestroy`);
}
// Called when a StatusBarViewExtensionAbility component is destroyed.
onDestroy() {
console.info(TAG, `onDestroy`);
}
}