加入收藏
举报
02-14 20:02
#0
文件名称:
OHOS-Ability.md
所在目录:
Openharmony v1.0 / docs / api / api-SmartVision-Devices
文件大小:
12.68 KB
下载地址:
fenwii/OpenHarmony
   
免责声明:本网站仅提供指向 GitHub 上的文件的链接,所有文件的版权归原作者所有,本网站不对文件内容的合法性、准确性或安全性承担任何责任。
文本预览:
# OHOS::Ability
## **Overview**
**Related Modules:**
[AbilityKit](AbilityKit.md)
**Description:**
Declares ability-related functions, including ability lifecycle callbacks and functions for connecting to or disconnecting from Particle Abilities.
As the fundamental unit of OpenHarmony applications, abilities are classified into [Feature](Feature.md) Abilities and Particle Abilities. [Feature](Feature.md) Abilities support the Page template, and Particle Abilities support the [Service](Service.md) template. An ability using the Page template is called Page ability for short and that using the [Service](Service.md) template is called [Service](Service.md) ability.
**Since:**
1.0
**Version:**
1.0
## **Summary**
## Public Member Functions






















































Public Member Function Name


Description


OnStart (const Want &want)


virtual void 


Called when this ability is started. You must override this function if you want to perform some initialization operations during ability startup.


OnInactive ()


virtual void 


Called when this ability enters the STATE_INACTIVE state.


OnActive (const Want &want)


virtual void 


Called when this ability enters the STATE_ACTIVE state.


OnBackground ()


virtual void 


Called when this ability enters the STATE_BACKGROUND state.


OnStop ()


virtual void 


Called when this ability enters the STATE_STOP state.


OnConnect (const Want &want)


virtual const SvcIdentity * 


Called when this Service ability is connected for the first time.


OnDisconnect (const Want &want)


virtual void 


Called when all abilities connected to this Service ability are disconnected.


SetMainRoute (const std::string &entry)


void 


Sets the main route for this ability.


SetUIContent (RootView *rootView)


void 


Sets the UI layout for this ability. You can call GetWindowRootView() to create a layout and add controls.


MsgHandle (uint32_t funcId, IpcIo *request, IpcIo *reply)


virtual void 


Handles a message sent by the client to this Service ability.


Dump (const std::string &extra)


virtual void 


Prints ability information to the console.


StartAbility (const Want &want)


int 


Starts an Ability based on the specified Want information.


StopAbility (const Want &want)


int 


Stops an Ability based on the specified Want information.


TerminateAbility ()


int 


Destroys this Ability.


ConnectAbility (const Want &want, const IAbilityConnection &conn, void *data)


int 


Connects to a Service ability based on the specified Want information.


DisconnectAbility (const IAbilityConnection &conn)


int 


Disconnects from a Service ability.


点赞 回复
回帖
支持markdown部分语法 ?