程序包 net_62v.external

类 MetaActivityManager

java.lang.Object
net_62v.external.MetaActivityManager

public final class MetaActivityManager extends Object
A class for components management, you can launch app by using this class.
版本:
1.2
作者:
king@62v.net
另请参阅:
  • 构造器详细资料

    • MetaActivityManager

      public MetaActivityManager()
  • 方法详细资料

    • obtainSplashLaunchIntent

      public static Intent obtainSplashLaunchIntent(String pkg, Context context) throws RemoteException
      Obtain a splash screen intent
      参数:
      pkg - package name
      context - app context
      抛出:
      RemoteException
      另请参阅:
    • launchApp

      public static void launchApp(String pkg) throws RemoteException
      Launch a specific package with the default user name
      参数:
      pkg - package name
      抛出:
      RemoteException
    • launchActivityExistingAppProcess

      public static void launchActivityExistingAppProcess(String pkg) throws RemoteException
      抛出:
      RemoteException
    • launchActivityExistingAppProcess

      public static void launchActivityExistingAppProcess(String pkg, String username) throws RemoteException
      Launch an app which is running directly, will success only if the app was launched (without hesitation).
      You must call the function isAppRunning before calling this method
      参数:
      pkg - package name you want to launch
      username - user name, must be alphabetical
      抛出:
      RemoteException
    • initialize

      public static void initialize(Context context)
      Initialize the environment
      参数:
      context - application base context
    • isInnerPackageInstalled

      public static boolean isInnerPackageInstalled(String pkg) throws RemoteException
      Detect if an app is installed or not
      参数:
      pkg - package name
      返回:
      if app was installed already then true, otherwise false.
      抛出:
      RemoteException
    • isAppRunning

      public static boolean isAppRunning(String pkg) throws RemoteException
      抛出:
      RemoteException
    • isAppRunning

      public static boolean isAppRunning(String pkg, String username) throws RemoteException
      Detect if an app is running or not
      参数:
      pkg - package name
      username - user name
      返回:
      true if the app is running
      抛出:
      RemoteException
    • launchExistingApp

      public static void launchExistingApp(String pkg, String username) throws RemoteException
      Launch an existing app process, will be the same behaviour as launchActivityExistingAppProcess if the app is running
      If an app is already running, then move its splash screen to the display top.
      参数:
      pkg - package name
      username - user name
      抛出:
      RemoteException
      另请参阅:
    • isAppRunning

      public static boolean isAppRunning(String pkg, int uid) throws RemoteException
      Detect if an app is running
      参数:
      pkg - package name
      uid - user name (alias of user name, use String.valueOf to convert)
      返回:
      true if the app is running
      抛出:
      RemoteException
    • killAllApps

      public static void killAllApps() throws RemoteException
      Kill all running applications
      抛出:
      RemoteException
      另请参阅:
    • launchApp

      public static void launchApp(int uid, String pkg) throws RemoteException
      Launch an app, mostly used function.
      参数:
      uid - userid, same as the String user name function.
      pkg - package name
      抛出:
      RemoteException
      另请参阅:
    • launchApp

      public static void launchApp(String username, String pkg) throws RemoteException
      Launch an app and initialize its environment.
      You can launch a specific app by this method.
      参数:
      username - user name, you can use the String.valueOf to convert
      pkg - package name MetaActivityManager.launchApp("0", "com.whatsapp")
      抛出:
      RemoteException
    • obtainSplashLaunchIntent

      public static Intent obtainSplashLaunchIntent(int username, String pkg, Context context) throws RemoteException
      Numeric user name method
      抛出:
      RemoteException
      另请参阅:
    • obtainSplashLaunchIntent

      public static Intent obtainSplashLaunchIntent(String username, String pkg, Context context) throws RemoteException
      Obtain a splash screen intent

      val splash = MetaActivityManager.obtainSplashLaunchIntent("0", "com.whatsapp", this)

      startActivity(splash)

      参数:
      username - user name
      pkg - package name
      context - app context
      返回:
      if null then application already launched, else you should call the startActivity function, and you must manual start the activity intent if return not null value
      抛出:
      RemoteException
      另请参阅:
    • factoryReset

      public static void factoryReset()
      Delete all apps you've installed.
      另请参阅:
      • FilesKt__UtilsKt.deleteRecursively(File)
    • launchIntent

      public static void launchIntent(Intent intent) throws RemoteException
      抛出:
      RemoteException
    • launchIntent

      public static void launchIntent(Intent intent, int uid) throws RemoteException
      抛出:
      RemoteException
    • launchIntent

      public static void launchIntent(Intent intent, String username) throws RemoteException
      Launch a specific intent, you can launch an intent with specific extras or data here
      Can launch a disabled activity, and please add a NEW_TASK flag to launch
      参数:
      intent - intent you want to launch
      username - user name
      抛出:
      RemoteException
    • startService

      public static void startService(Intent intent, String userName) throws RemoteException
      Start a specific service, will automatic launch the affiliated process.
      You can launch an empty service for process waken purpose.
      参数:
      intent - service intent you wanna start
      userName - split region
      抛出:
      RemoteException - may generate a remote exception when you call this method on a different process.
      从以下版本开始:
      V1.1
    • startService

      public static void startService(Intent intent, int userName) throws RemoteException
      参数:
      intent - service intent
      userName - user split region
      抛出:
      RemoteException
      另请参阅:
    • killAppByPkg

      public static void killAppByPkg(String pkg) throws RemoteException
      Kill application process, with app relevant users
      参数:
      pkg - package name
      抛出:
      RemoteException
    • broadcastIntentAsUser

      public static int broadcastIntentAsUser(Intent intent, String username) throws RemoteException
      Broadcast an intent to internal app
      参数:
      intent - intent you want to broadcast
      username - user name
      返回:
      1 if success
      抛出:
      RemoteException
    • broadcastIntentAsUser

      public static int broadcastIntentAsUser(Intent intent, int username) throws RemoteException
      抛出:
      RemoteException
    • killAppByPkg

      public static void killAppByPkg(String username, String pkg) throws RemoteException
      Kill application process by package name and user name
      参数:
      username - user name
      pkg - package name
      抛出:
      RemoteException
    • killAppByPkg

      public static void killAppByPkg(int uid, String pkg) throws RemoteException
      抛出:
      RemoteException
    • setUserName

      public static void setUserName(String username)
      Set a default user name, and defaults 0
      参数:
      username - user name
    • acquirePreloadNextProcess

      public static void acquirePreloadNextProcess() throws RemoteException
      You can call this function in your main activity.
      Calling this method is not necessary.
      This method will boost the first application launch progress.
      抛出:
      RemoteException
      另请参阅:
    • getRunningProcessInfo

      public static List<ActivityManager.RunningAppProcessInfo> getRunningProcessInfo(String packageName) throws RemoteException
      Get running app process info
      参数:
      packageName - package name can be specific to query
      返回:
      List of the running application info
      抛出:
      RemoteException
      另请参阅:
    • finishApplicationActivity

      public static void finishApplicationActivity(String packageName, String className) throws RemoteException
      Finish the specific app activities.
      You can call this method before you manually launch an activity by your custom intent.
      参数:
      packageName - Package name
      className - Class name, can be null, if null then finish all relevant activities of the package name.
      抛出:
      RemoteException