Class AppManagementCtrl

java.lang.Object
com.unitech.api.app.AppManagementCtrl

public class AppManagementCtrl extends 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 Details

  • Constructor Details

    • AppManagementCtrl

      public AppManagementCtrl(android.content.Context context)
      Instantiates a new AppManagementCtrl.
      Parameters:
      context - the context
  • Method Details

    • getAppPackageName

      public String getAppPackageName(String apkPath)
    • installApp

      public android.os.Bundle installApp(String apkFilePath, 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");
    • installApp

      public android.os.Bundle installApp(String apkFilePath, String pkgName, String[] permissions)
      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
      permissions - 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

      public android.os.Bundle removeApp(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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
    • activateApp

      public android.os.Bundle activateApp(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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
    • activateAppWithClassName

      public android.os.Bundle activateAppWithClassName(String pkgName, String className)
      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

      public android.os.Bundle deactivateApp(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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
    • enableApp

      public android.os.Bundle enableApp(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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
    • disableApp

      public android.os.Bundle disableApp(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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
    • clearAppData

      public android.os.Bundle clearAppData(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. (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

      public android.os.Bundle osUpdate(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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
    • runSysCmd

      public android.os.Bundle runSysCmd(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(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(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 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 app
      activityName - 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

      public android.os.Bundle resolveActivity(String action, String[] categories, String packageName)
      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

      public android.os.Bundle queryIntentService(String action, String packageName)
      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)
      List serviceNameList = bundle.getStringArrayList("ServiceInfoNameList");
      String errorMsg = bundle.getString("errorMsg");
    • clearDefaultApps

      public android.os.Bundle clearDefaultApps(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 errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
    • clearDefaultApps

      public android.os.Bundle clearDefaultApps(String action, 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 query
      categories - 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

      public android.os.Bundle grantAppPermission(String packageName, String[] permissions)
      grant application permission (packageName)
      Parameters:
      packageName - The package name of the target app
      permissions - 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");