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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBundleactivateApp(String pkgName) Activate an app on device.BundleactivateAppWithClassName(String pkgName, String className) Activate an app on device.BundlebringAppToFront(String packageName) Bring an app to front.BundleclearAppData(String pkgName) Clear the storage data and the cache data of the app.BundleclearDefaultApps(String[] packages) Clear the settings of the preferred apps by giving the package name listBundleclearDefaultApps(String action, String[] categories) Clear the settings of the preferred apps by giving the filter (action and categories)BundledeactivateApp(String pkgName) Deactivate an app on device.BundledisableApp(String pkgName) Disable an app on device.BundleEnable an app on device.BundleGet all apps list with their app name (Only return apps which have app label)BundleGet all apps list with their package nameBundlegetAppInfoByAppName(String appName) Get the app version name and version code by the app name (App label)BundlegetAppInfoByPkgName(String pkgName) Get the app version name and version code by the package namegetAppPackageName(String apkPath) BundleGet the built-in system apps list with their app name (Only return apps which have app label)BundleGet the built-in system apps list with their package nameBundleGet the disabled apps list with their app name (Only return apps which have app label)BundleGet the disabled apps list with their package nameBundleGet the installed apps list with their app name (Only return apps which have app label)BundleGet the installed apps list with their package nameBundleGet the current running apps list with their app name (Only return apps which have app label)BundleGet the current running apps list with their package nameBundlegrantAppPermission(String packageName, String[] permissions) grant application permission (packageName)BundleinstallApp(String apkFilePath, String pkgName) Install an application by the apk that user mention tha apk file path.BundleinstallApp(String apkFilePath, String pkgName, String[] permissions) Install an application by the apk that user mention tha apk file path.BundleUpdate device's OS by the zip fileBundlequeryIntentService(String action, String packageName) query intent service with action and packageNameBundleRemove an app from deviceBundleresolveActivity(String action, String[] categories, String packageName) resolve the Activity Name with action, categories and packageNameBundleRun shell command with system userBundlesetDefaultApp(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(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");
-
bringAppToFront
Bring an app to front.- Parameters:
packageName- The package name of the app that you want to bring to front.- 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 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 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 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 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 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 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 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 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 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 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 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");
-