目录

class info
com.huawei.hms.mlsdk.common.MLApplication
Represents an app information class used to store basic information about apps with the HMS Core ML SDK integrated. Generally, an app does not directly interact with this class. The HMS Core ML SDK initializes HUAWEI ML Kit based on the agconnect-services.json file without extra coding.

Constant Summary

TypeNameDesc
StringDEFAULT_APP_NAMEDefault app name.

Public Method Summary

Return typeMethod name
android.content.ContextgetAppContext()
List<MLApplication>getAppList(android.content.Context context)
StringgetAppName()
MLApplicationSettinggetAppSetting()
MLApplicationgetInstance()
MLApplicationgetInstance(String name)
StringgetUniqueKey()
StringgetUniqueKey(String name, MLApplicationSetting setting)
MLApplicationinitialize(android.content.Context context)
MLApplicationinitialize(android.content.Context context, MLApplicationSetting setting)
MLApplicationinitialize(android.content.Context context, MLApplicationSetting setting, String name)
booleanisDefault()
StringtoString()

Constants

Constant
public static final String DEFAULT_APP_NAME

Default app name.

Constant value: _DEFAULT

Public Methods

Method
public android.content.Context getAppContext()
Obtains the context of an app.

Return

Typedesc
android.content.ContextApp context
Method
public static List<MLApplication> getAppList(android.content.Context context)
Obtains an app list.

Parameters

Parameter nameParameter desc
contextApp context


Return

Typedesc
List<MLApplication>App list
Method
public String getAppName()
Obtains the name of an app.

Return

Typedesc
StringApp name
Method
public MLApplicationSetting getAppSetting()
Obtains the settings of an app.

Return

Typedesc
MLApplicationSettingApp settings
Method
public static MLApplication getInstance()
Obtains the default app instance.

Return

Typedesc
MLApplicationDefault app instance
Method
public static MLApplication getInstance(String name)
Obtains the app instance with the specified name.

Parameters

Parameter nameParameter desc
nameApp name


Return

Typedesc
MLApplicationApp instance with the specified name.
Method
public String getUniqueKey()
Obtains the unique key value of the current app.

Return

Typedesc
StringUnique key value of the current app.
Method
public static String getUniqueKey(String name, MLApplicationSetting setting)
Obtains the unique key value of the app with the specified name and settings.

Parameters

Parameter nameParameter desc
nameApp name
settingApp settings


Return

Typedesc
StringUnique key value of the app with the specified name and settings.
Method
public static MLApplication initialize(android.content.Context context)
Initializes an app instance using the default name.

Parameters

Parameter nameParameter desc
contextApp context


Return

Typedesc
MLApplicationApp instance with the default name.
Method
public static MLApplication initialize(android.content.Context context, MLApplicationSetting setting)
Initializes an HmsMLApp instance using custom app settings, including the APK name and API key.

Parameters

Parameter nameParameter desc
contextApp context
settingCustom app settings


Return

Typedesc
MLApplicationApp instance with the custom settings.
Method
public static MLApplication initialize(android.content.Context context, MLApplicationSetting setting, String name)
Initializes an app instance using the custom app settings and name.

Parameters

Parameter nameParameter desc
contextApp context
settingCustom app settings
nameCustom app name


Return

Typedesc
MLApplicationApp instance with the custom settings and name.
Method
public boolean isDefault()
Checks whether an app instance is the default one.

Return

Typedesc
booleantrue: default instance
false: non-default instance
Method
public String toString()
Converts the current instance into a character string.

Return

Typedesc
StringCharacter string of the current instance.