Package com.unitech.api.app
Class AppManagementCtrl
java.lang.Object
com.unitech.api.app.AppManagementCtrl
*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 -
Constructor Summary
ConstructorsConstructorDescriptionAppManagementCtrl(android.content.Context context) Instantiates a new AppManagementCtrl. -
Method Summary
Modifier and TypeMethodDescriptionandroid.os.BundleactivateApp(String pkgName) Activate an app on device.android.os.BundleactivateAppWithClassName(String pkgName, String className) Activate an app on device.android.os.BundleclearAppData(String pkgName) Clear the storage data and the cache data of the app.android.os.BundleclearDefaultApps(String[] packages) Clear the settings of the preferred apps by giving the package name listandroid.os.BundleclearDefaultApps(String action, String[] categories) Clear the settings of the preferred apps by giving the filter (action and categories)android.os.BundledeactivateApp(String pkgName) Deactivate an app on device.android.os.BundledisableApp(String pkgName) Disable an app on device.android.os.BundleEnable an app on device.android.os.BundleGet all apps list with their app name (Only return apps which have app label)android.os.BundleGet all apps list with their package nameandroid.os.BundlegetAppInfoByAppName(String appName) Get the app version name and version code by the app name (App label)android.os.BundlegetAppInfoByPkgName(String pkgName) Get the app version name and version code by the package namegetAppPackageName(String apkPath) android.os.BundleGet the built-in system apps list with their app name (Only return apps which have app label)android.os.BundleGet the built-in system apps list with their package nameandroid.os.BundleGet the disabled apps list with their app name (Only return apps which have app label)android.os.BundleGet the disabled apps list with their package nameandroid.os.BundleGet the installed apps list with their app name (Only return apps which have app label)android.os.BundleGet the installed apps list with their package nameandroid.os.BundleGet the current running apps list with their app name (Only return apps which have app label)android.os.BundleGet the current running apps list with their package nameandroid.os.BundlegrantAppPermission(String packageName, String[] permissions) grant application permission (packageName)android.os.BundleinstallApp(String apkFilePath, String pkgName) Install an application by the apk that user mention tha apk file path.android.os.BundleinstallApp(String apkFilePath, String pkgName, String[] permissions) Install an application by the apk that user mention tha apk file path.android.os.BundleUpdate device's OS by the zip fileandroid.os.BundlequeryIntentService(String action, String packageName) query intent service with action and packageNameandroid.os.BundleRemove an app from deviceandroid.os.BundleresolveActivity(String action, String[] categories, String packageName) resolve the Activity Name with action, categories and packageNameandroid.os.BundleRun shell command with system userandroid.os.BundlesetDefaultApp(String action, String[] categories, String packageName, String activityName) Set the preferred app with the given filter (action and categories)
-
Field Details
-
BUNDLE_ERROR_CODE
- See Also:
-
BUNDLE_ERROR_MSG
- See Also:
-
BUNDLE_RESULT_APP_NAME_LIST
- See Also:
-
BUNDLE_RESULT_PKG_NAME_LIST
- See Also:
-
BUNDLE_RESULT_SERVICEINFO_NAME_LIST
- See Also:
-
BUNDLE_RESULT_CMD
- See Also:
-
BUNDLE_RESULT_APP_INFO
- See Also:
-
RESULT_CODE_ERROR
public static final int RESULT_CODE_ERROR- See Also:
-
RESULT_CODE_SUCCESS
public static final int RESULT_CODE_SUCCESS- See Also:
-
-
Constructor Details
-
AppManagementCtrl
public AppManagementCtrl(android.content.Context context) Instantiates a new AppManagementCtrl.- Parameters:
context- the context
-
-
Method Details
-
getAppPackageName
-
installApp
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");
-
installApp
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 apkpermissions- permissions to be granted, null for all permissions- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
removeApp
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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
activateApp
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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
activateAppWithClassName
Activate an app on device.- Parameters:
pkgName- The package name of the app that you want to activate.className- The Activity class name of the app that you want to activate.- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
deactivateApp
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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
enableApp
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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
disableApp
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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
clearAppData
Clear the storage data and the cache data of the app.- Parameters:
pkgName- The package name of the app that you want to clear. (example: com.ute.eu.ELauncher)- Returns:
- A bundle contains the error code and message
int errorCode = 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 errorCode = 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 errorCode = 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 errorCode = 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 errorCode = 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 errorCode = 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 errorCode = 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 errorCode = 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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
StringArrayList strAL = bundle.getStringArrayList("PkgNameList");
-
getAllAppNameList
public android.os.Bundle getAllAppNameList()Get all apps list with their app name (Only return apps which have app label)- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
StringArrayList strAL = bundle.getStringArrayList("AppNameList");
-
getAllPkgNameList
public android.os.Bundle getAllPkgNameList()Get all apps list with their package name- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
StringArrayList strAL = bundle.getStringArrayList("PkgNameList");
-
osUpdate
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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
runSysCmd
Run shell command with system user- Parameters:
command- The shell command- Returns:
- Bundle contain BUNDLE_ERROR_CODE, BUNDLE_ERROR_MSG, BUNDLE_RESULT_CMD
-
getAppInfoByAppName
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
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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
Bundle bundle = bundle.getBundle("AppInfo");
-
setDefaultApp
public android.os.Bundle setDefaultApp(String action, String[] categories, String packageName, 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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
resolveActivity
resolve the Activity Name with action, categories and packageName- Parameters:
action-categories-packageName- The package name of the target app- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String activityname = bundle.getString("ResolveInfo_ActivityInfoName");
String errorMsg = bundle.getString("errorMsg");
-
queryIntentService
query intent service with action and packageName- Parameters:
action-packageName- The package name of the target app- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
ListserviceNameList = bundle.getStringArrayList("ServiceInfoNameList");
String errorMsg = bundle.getString("errorMsg");
-
clearDefaultApps
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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
clearDefaultApps
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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
grantAppPermission
grant application permission (packageName)- Parameters:
packageName- The package name of the target apppermissions- permissions to be granted, null for all permissions- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-