树叶云鸿蒙OS教程:鸿蒙OS LauncherAbilityInfo

LauncherAbilityInfo

java.lang.Object

|—ohos.bundle.LauncherAbilityInfo

public class LauncherAbilityInfo
extends Object

提供有关从主屏幕启动的应用程序的启动器ability的信息。

构造函数摘要

构造函数描述
LauncherAbilityInfo(Context context, AbilityInfo info, int userId)用于创建 LauncherAbilityInfo 实例的构造函数。

方法总结

修饰符和类型方法描述
ApplicationInfogetApplicationInfo()获取ability所属应用的信息。
ElementNamegetElementName()获取ability的元素名称。
ElementgetIcon()获得ability的图标。
longgetInstallTime()获取应用安装时间。
StringgetLabel()获得ability的标签。
StringgetName()获取ability的类名。
intgetUserId()获取ability所属用户的ID。
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

构造函数详细信息

LauncherAbilityInfo

public LauncherAbilityInfo(Context context, AbilityInfo info, int userId)

用于创建 LauncherAbilityInfo 实例的构造函数。

参数:

参数名称参数描述
context指示启动器ability的上下文对象。
info表示启动器的ability。
userId表示用户标识。

方法详情

getApplicationInfo

public ApplicationInfo getApplicationInfo()

获取ability所属应用的信息。

返回:

返回应用程序信息。

getElementName

public ElementName getElementName()

获取ability的元素名称。

返回:

返回当前ability的元素名称。

getUserId

public int getUserId()

获取ability所属用户的ID。

返回:

返回ability的用户 ID。

getName

public String getName()

获取ability的类名。

返回:

返回ability的类名。

getLabel

public String getLabel()

获得ability的标签。

返回:

如果获得,则返回ability的标签; 否则返回当前应用程序的标签。

getIcon

public Element getIcon()

获得ability的图标。

返回:

返回ability的图标。

getInstallTime

public long getInstallTime()

获取应用安装时间。 安装时间是自 1970 年 1 月 1 日 00:00:00 UTC 以来经过的秒数。 如果卸载后重新安装应用程序,将重新计算时间。

返回:

返回应用程序安装时间。

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/213051.html<

(0)
运维的头像运维
上一篇2025-04-11 03:47
下一篇 2025-04-11 03:49

相关推荐

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注