Package com.unitech.api.app
Class AppManagementCtrl
- java.lang.Object
-
- com.unitech.api.app.AppManagementCtrl
-
public class AppManagementCtrl extends java.lang.Object*Need to install AppCtrlService to use this controller. This controller provide the ability to manage the applications on device. This controller can install, uninstall, enable, disable, activate, deactivate the applications. This controller can also get the app list which is running, installed or belonging to system.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBUNDLE_ERROR_CODEstatic java.lang.StringBUNDLE_ERROR_MSGstatic java.lang.StringBUNDLE_RESULT_APP_INFOstatic java.lang.StringBUNDLE_RESULT_APP_NAME_LISTstatic java.lang.StringBUNDLE_RESULT_CMDstatic java.lang.StringBUNDLE_RESULT_PKG_NAME_LISTstatic intRESULT_CODE_ERRORstatic intRESULT_CODE_SUCCESS
-
Constructor Summary
Constructors Constructor Description AppManagementCtrl(android.content.Context context)Instantiates a new AppManagementCtrl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description android.os.BundleactivateApp(java.lang.String pkgName)Activate an app on device.android.os.BundleclearAppData(java.lang.String pkgName)Clear the storage data and the cache data of the app.android.os.BundleclearDefaultApps(java.lang.String[] packages)Clear the settings of the preferred apps by giving the package name listandroid.os.BundleclearDefaultApps(java.lang.String action, java.lang.String[] categories)Clear the settings of the preferred apps by giving the filter (action and categories)android.os.BundledeactivateApp(java.lang.String pkgName)Deactivate an app on device.android.os.BundledisableApp(java.lang.String pkgName)Disable an app on device.android.os.BundleenableApp(java.lang.String pkgName)Enable an app on device.android.os.BundlegetAppInfoByAppName(java.lang.String appName)Get the app version name and version code by the app name (App label)android.os.BundlegetAppInfoByPkgName(java.lang.String pkgName)Get the app version name and version code by the package namejava.lang.StringgetAppPackageName(java.lang.String apkPath)android.os.BundlegetBuiltinSystemAppNameList()Get the built-in system apps list with their app name (Only return apps which have app label)android.os.BundlegetBuiltinSystemPkgNameList()Get the built-in system apps list with their package nameandroid.os.BundlegetDisabledAppNameList()Get the disabled apps list with their app name (Only return apps which have app label)android.os.BundlegetDisabledPkgNameList()Get the disabled apps list with their package nameandroid.os.BundlegetInstallAppNameList()Get the installed apps list with their app name (Only return apps which have app label)android.os.BundlegetInstallPkgNameList()Get the installed apps list with their package nameandroid.os.BundlegetRunningAppNameList()Get the current running apps list with their app name (Only return apps which have app label)android.os.BundlegetRunningPkgNameList()Get the current running apps list with their package nameandroid.os.BundleinstallApp(java.lang.String apkFilePath, java.lang.String pkgName)Install an application by the apk that user mention tha apk file path.android.os.BundleosUpdate(java.lang.String updateZipPath)Update device's OS by the zip fileandroid.os.BundleremoveApp(java.lang.String pkgName)Remove an app from deviceandroid.os.BundlerunSysCmd(java.lang.String command)Run shell command with system userandroid.os.BundlesetDefaultApp(java.lang.String action, java.lang.String[] categories, java.lang.String packageName, java.lang.String activityName)Set the preferred app with the given filter (action and categories)
-
-
-
Field Detail
-
BUNDLE_ERROR_CODE
public static final java.lang.String BUNDLE_ERROR_CODE
- See Also:
- Constant Field Values
-
BUNDLE_ERROR_MSG
public static final java.lang.String BUNDLE_ERROR_MSG
- See Also:
- Constant Field Values
-
BUNDLE_RESULT_APP_NAME_LIST
public static final java.lang.String BUNDLE_RESULT_APP_NAME_LIST
- See Also:
- Constant Field Values
-
BUNDLE_RESULT_PKG_NAME_LIST
public static final java.lang.String BUNDLE_RESULT_PKG_NAME_LIST
- See Also:
- Constant Field Values
-
BUNDLE_RESULT_CMD
public static final java.lang.String BUNDLE_RESULT_CMD
- See Also:
- Constant Field Values
-
BUNDLE_RESULT_APP_INFO
public static final java.lang.String BUNDLE_RESULT_APP_INFO
- See Also:
- Constant Field Values
-
RESULT_CODE_ERROR
public static final int RESULT_CODE_ERROR
- See Also:
- Constant Field Values
-
RESULT_CODE_SUCCESS
public static final int RESULT_CODE_SUCCESS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAppPackageName
public java.lang.String getAppPackageName(java.lang.String apkPath)
-
installApp
public android.os.Bundle installApp(java.lang.String apkFilePath, java.lang.String pkgName)Install an application by the apk that user mention tha apk file path.- Parameters:
apkFilePath- The path where is the apk file at.pkgName- The package name of the apk- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
removeApp
public android.os.Bundle removeApp(java.lang.String pkgName)
Remove an app from device- Parameters:
pkgName- The package name of the app that you want to remove.- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
activateApp
public android.os.Bundle activateApp(java.lang.String pkgName)
Activate an app on device.- Parameters:
pkgName- The package name of the app that you want to activate.- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
deactivateApp
public android.os.Bundle deactivateApp(java.lang.String pkgName)
Deactivate an app on device.- Parameters:
pkgName- The package name of the app that you want to deactivate.- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
enableApp
public android.os.Bundle enableApp(java.lang.String pkgName)
Enable an app on device.- Parameters:
pkgName- The package name of the app that you want to enable.- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
disableApp
public android.os.Bundle disableApp(java.lang.String pkgName)
Disable an app on device.- Parameters:
pkgName- The package name of the app that you want to disable.- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
clearAppData
public android.os.Bundle clearAppData(java.lang.String pkgName)
Clear the storage data and the cache data of the app.- Parameters:
pkgName- The package name of the app that you want to clear. PackageName Array, (split with , ) (example: com.ute.eu.ELauncher,com.unitech.unote)- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
getRunningAppNameList
public android.os.Bundle getRunningAppNameList()
Get the current running apps list with their app name (Only return apps which have app label)- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
StringArrayList strAL = bundle.getStringArrayList("AppNameList");
-
getRunningPkgNameList
public android.os.Bundle getRunningPkgNameList()
Get the current running apps list with their package name- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
StringArrayList strAL = bundle.getStringArrayList("PkgNameList");
-
getInstallAppNameList
public android.os.Bundle getInstallAppNameList()
Get the installed apps list with their app name (Only return apps which have app label)- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
StringArrayList strAL = bundle.getStringArrayList("AppNameList");
-
getInstallPkgNameList
public android.os.Bundle getInstallPkgNameList()
Get the installed apps list with their package name- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
StringArrayList strAL = bundle.getStringArrayList("PkgNameList");
-
getBuiltinSystemAppNameList
public android.os.Bundle getBuiltinSystemAppNameList()
Get the built-in system apps list with their app name (Only return apps which have app label)- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
StringArrayList strAL = bundle.getStringArrayList("AppNameList");
-
getBuiltinSystemPkgNameList
public android.os.Bundle getBuiltinSystemPkgNameList()
Get the built-in system apps list with their package name- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
StringArrayList strAL = bundle.getStringArrayList("PkgNameList");
-
getDisabledAppNameList
public android.os.Bundle getDisabledAppNameList()
Get the disabled apps list with their app name (Only return apps which have app label)- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
StringArrayList strAL = bundle.getStringArrayList("AppNameList");
-
getDisabledPkgNameList
public android.os.Bundle getDisabledPkgNameList()
Get the disabled apps list with their package name- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
StringArrayList strAL = bundle.getStringArrayList("PkgNameList");
-
osUpdate
public android.os.Bundle osUpdate(java.lang.String updateZipPath)
Update device's OS by the zip file- Parameters:
updateZipPath- The zip path of the OS OTA pack- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
runSysCmd
public android.os.Bundle runSysCmd(java.lang.String command)
Run shell command with system user- Parameters:
command- The shell command- Returns:
- Bundle contain BUNDLE_ERROR_CODE, BUNDLE_ERROR_MSG, BUNDLE_RESULT_CMD
-
getAppInfoByAppName
public android.os.Bundle getAppInfoByAppName(java.lang.String appName)
Get the app version name and version code by the app name (App label)- Parameters:
appName- The app name that you want to get its information- Returns:
- Bundle contain BUNDLE_ERROR_CODE, BUNDLE_ERROR_MSG, BUNDLE_RESULT_APP_INFO
-
getAppInfoByPkgName
public android.os.Bundle getAppInfoByPkgName(java.lang.String pkgName)
Get the app version name and version code by the package name- Parameters:
pkgName- The package name that you want to get its information- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
Bundle bundle = bundle.getBundle("AppInfo");
-
setDefaultApp
public android.os.Bundle setDefaultApp(java.lang.String action, java.lang.String[] categories, java.lang.String packageName, java.lang.String activityName)Set the preferred app with the given filter (action and categories)- Parameters:
action-categories-packageName- The package name of the target appactivityName- The target activity in the package- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
clearDefaultApps
public android.os.Bundle clearDefaultApps(java.lang.String[] packages)
Clear the settings of the preferred apps by giving the package name list- Parameters:
packages- All the package names that you want to clear- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
clearDefaultApps
public android.os.Bundle clearDefaultApps(java.lang.String action, java.lang.String[] categories)Clear the settings of the preferred apps by giving the filter (action and categories)- Parameters:
action- The action that the intent-filter needs to querycategories- The categories that the intent-filter needs to query- Returns:
- A bundle contains the error code and message
int erroeCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
-