Class MetaApplicationInstaller

java.lang.Object
net_62v.external.MetaApplicationInstaller

public final class MetaApplicationInstaller extends Object
A class for package management, you can clone a specific app by calling the cloneApp(String) method.
You can install an app that not being installed on the host system by calling the installAppByPath(String) method.
Version:
1.0
Author:
king@62v.net
  • Constructor Details

    • MetaApplicationInstaller

      public MetaApplicationInstaller()
  • Method Details

    • cloneApp

      public static int cloneApp(String packageName, String defUserName) throws RemoteException
      Install an existing app which already been installed.
      Must be installed before, so this method also known as clone application.
      Usage:

      MetaApplicationInstaller.cloneApp("com.whatsapp")

      Parameters:
      packageName - package name like "com.whatsapp"
      defUserName - default user name, the default value is "0"
      Returns:
      install result, greater than 0 then success, otherwise you should convert it to see.
      Throws:
      RemoteException
    • cloneApp

      public static int cloneApp(String packageName) throws RemoteException
      Returns:
      Install result, should be always greater than 0
      Throws:
      RemoteException
      See Also:
    • installAppByPath

      public static int installAppByPath(String path) throws RemoteException
      Install apk from explorer etc. And you must give a direct path to install inside.
      Only support the standard apk file, please verify the file before you use this method.

      MetaApplicationInstaller.installAppByPath("/sdcard/sample.apk")

      Parameters:
      path - a direct apk path
      Returns:
      install result
      Throws:
      RemoteException
    • installAppByPathAndMove

      public static int installAppByPathAndMove(String path) throws RemoteException
      Same as installAppByPath(String), but will move the file at path.
      The file at such path will be moved or deleted,
      and you have to confirm if the file will be deleted after the installation progress.
      Parameters:
      path - a direct apk path
      Returns:
      install result
      Throws:
      RemoteException
    • installAppsByPath

      public static int installAppsByPath(String path) throws RemoteException
      Install apks (split apk) from explorer etc. And you must give a direct path to install inside.
      Support dir or apks / apkm / xapk format file

      MetaApplicationInstaller.installAppsByPath("/sdcard/pure.xapk")

      Parameters:
      path - a direct xapk (also the apkm and apks) path
      Returns:
      install result
      Throws:
      RemoteException
    • installAppsByPathAndMove

      public static int installAppsByPathAndMove(String path) throws RemoteException
      Same as installAppsByPath(String), but will move the folder at path.
      The content in such folder will be moved or deleted,
      and you have to confirm if the files will be deleted after the installation progress.
      Parameters:
      path - a direct xapk (also the apkm and apks) path
      Returns:
      install result
      Throws:
      RemoteException
    • convertResultToString

      public static String convertResultToString(int installResult)
      Convert the install result to a readable string, mostly greater than 0 is success, otherwise you can
      use this api for debug purpose, and can be shown to users for comprehensive.
      Parameters:
      installResult - install result integer
      Returns:
      readable string