鴻蒙OS LauncherAbilityInfo

2022-04-25 16:33 更新

LauncherAbilityInfo

java.lang.Object

|---ohos.bundle.LauncherAbilityInfo

public class LauncherAbilityInfo
extends Object

提供有關(guān)從主屏幕啟動的應(yīng)用程序的啟動器ability的信息。

構(gòu)造函數(shù)摘要

構(gòu)造函數(shù) 描述
LauncherAbilityInfo(Context context, AbilityInfo info, int userId) 用于創(chuàng)建 LauncherAbilityInfo 實例的構(gòu)造函數(shù)。

方法總結(jié)

修飾符和類型 方法 描述
ApplicationInfo getApplicationInfo() 獲取ability所屬應(yīng)用的信息。
ElementName getElementName() 獲取ability的元素名稱。
Element getIcon() 獲得ability的圖標(biāo)。
long getInstallTime() 獲取應(yīng)用安裝時間。
String getLabel() 獲得ability的標(biāo)簽。
String getName() 獲取ability的類名。
int getUserId() 獲取ability所屬用戶的ID。
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

構(gòu)造函數(shù)詳細信息

LauncherAbilityInfo

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

用于創(chuàng)建 LauncherAbilityInfo 實例的構(gòu)造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
context 指示啟動器ability的上下文對象。
info 表示啟動器的ability。
userId 表示用戶標(biāo)識。

方法詳情

getApplicationInfo

public ApplicationInfo getApplicationInfo()

獲取ability所屬應(yīng)用的信息。

返回:

返回應(yīng)用程序信息。

getElementName

public ElementName getElementName()

獲取ability的元素名稱。

返回:

返回當(dāng)前ability的元素名稱。

getUserId

public int getUserId()

獲取ability所屬用戶的ID。

返回:

返回ability的用戶 ID。

getName

public String getName()

獲取ability的類名。

返回:

返回ability的類名。

getLabel

public String getLabel()

獲得ability的標(biāo)簽。

返回:

如果獲得,則返回ability的標(biāo)簽; 否則返回當(dāng)前應(yīng)用程序的標(biāo)簽。

getIcon

public Element getIcon()

獲得ability的圖標(biāo)。

返回:

返回ability的圖標(biāo)。

getInstallTime

public long getInstallTime()

獲取應(yīng)用安裝時間。 安裝時間是自 1970 年 1 月 1 日 00:00:00 UTC 以來經(jīng)過的秒數(shù)。 如果卸載后重新安裝應(yīng)用程序,將重新計算時間。

返回:

返回應(yīng)用程序安裝時間。

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號