Package lu.die.fozacompatibility
Class FozaActivityManager
java.lang.Object
lu.die.fozacompatibility.FozaActivityManager
- Version:
- 1.0
- Author:
- king@62v.net
- See Also:
-
ActivityManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidYou can call this function in your main activity.intbroadcastIntentAsUser(android.content.Intent intent, int username) intbroadcastIntentAsUser(android.content.Intent intent, String username) Broadcast an intent to internal appvoidDelete all apps you've installed.static FozaActivityManagerget()getPackageByPid(int pid) voidinitialize(android.content.Context context) Initialize the environmentbooleanisAppRunning(String pkg) booleanisAppRunning(String pkg, int uid) Detect if an app is runningbooleanisAppRunning(String pkg, String username) Detect if an app is running or notbooleanDetect if an app is installed or notvoidKill all running applicationsvoidkillAppByPkg(int uid, String pkg) voidkillAppByPkg(String pkg) Kill application process, with app relevant usersvoidkillAppByPkg(String username, String pkg) Kill application process by package name and user namevoidvoidlaunchActivityExistingAppProcess(String pkg, String username) Launch an app which is running directly, will success only if the app was launched (without hesitation).voidLaunch an app, mostly used function.voidLaunch a specific package with the default user namevoidLaunch an app and initialize its environment.voidlaunchExistingApp(String pkg, String username) 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.voidlaunchIntent(android.content.Intent intent) voidlaunchIntent(android.content.Intent intent, int uid) voidlaunchIntent(android.content.Intent intent, String username) 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 launchandroid.content.IntentobtainSplashLaunchIntent(int username, String pkg, android.content.Context context) Numeric user name methodandroid.content.IntentobtainSplashLaunchIntent(String pkg, android.content.Context context) Obtain a splash screen intentandroid.content.IntentobtainSplashLaunchIntent(String username, String pkg, android.content.Context context) Obtain a splash screen intentvoidsetUserName(String username) Set a default user name, and defaults 0
-
Constructor Details
-
FozaActivityManager
public FozaActivityManager()
-
-
Method Details
-
get
-
obtainSplashLaunchIntent
Obtain a splash screen intent- Parameters:
pkg- package namecontext- app context- See Also:
-
launchApp
Launch a specific package with the default user name- Parameters:
pkg- package name
-
launchActivityExistingAppProcess
-
launchActivityExistingAppProcess
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- Parameters:
pkg- package name you want to launchusername- user name, must be alphabetical
-
initialize
public void initialize(android.content.Context context) Initialize the environment- Parameters:
context- application base context- See Also:
-
isInnerPackageInstalled
Detect if an app is installed or not- Parameters:
pkg- package name- Returns:
- if app was installed already then true, otherwise false.
-
isAppRunning
-
isAppRunning
Detect if an app is running or not- Parameters:
pkg- package nameusername- user name- Returns:
- true if the app is running
-
launchExistingApp
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.- Parameters:
pkg- package nameusername- user name- See Also:
-
isAppRunning
Detect if an app is running- Parameters:
pkg- package nameuid- user name (alias of user name, use String.valueOf to convert)- Returns:
- true if the app is running
-
killAllApps
public void killAllApps()Kill all running applications- See Also:
-
Process.killProcess(int)
-
launchApp
Launch an app, mostly used function.- Parameters:
uid- userid, same as the String user name function.pkg- package name- See Also:
-
launchApp
Launch an app and initialize its environment. You can launch a specific app by this method.- Parameters:
username- user name, you can use the String.valueOf to convertpkg- package nameFozaActivityManager.get().launchApp("0", "com.whatsapp")
-
obtainSplashLaunchIntent
public android.content.Intent obtainSplashLaunchIntent(int username, String pkg, android.content.Context context) Numeric user name method -
obtainSplashLaunchIntent
public android.content.Intent obtainSplashLaunchIntent(String username, String pkg, android.content.Context context) Obtain a splash screen intent- Parameters:
username- user namepkg- package namecontext- app context- Returns:
- 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
- See Also:
-
val splash = FozaActivityManager.get().obtainSplashLaunchIntent("0", "com.whatsapp", this) startActivity(splash)
-
factoryReset
public void factoryReset()Delete all apps you've installed.- See Also:
-
FilesKt__UtilsKt.deleteRecursively(File)
-
launchIntent
public void launchIntent(android.content.Intent intent) -
launchIntent
public void launchIntent(android.content.Intent intent, int uid) -
launchIntent
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- Parameters:
intent- intent you want to launchusername- user name
-
killAppByPkg
Kill application process, with app relevant users- Parameters:
pkg- package name
-
broadcastIntentAsUser
Broadcast an intent to internal app- Parameters:
intent- intent you want to broadcastusername- user name- Returns:
- 1 if success
-
broadcastIntentAsUser
public int broadcastIntentAsUser(android.content.Intent intent, int username) -
getPackageByPid
-
killAppByPkg
Kill application process by package name and user name- Parameters:
username- user namepkg- package name
-
killAppByPkg
-
setUserName
Set a default user name, and defaults 0- Parameters:
username- user name
-
acquirePreloadNextProcess
public void acquirePreloadNextProcess()You can call this function in your main activity. Calling this method is not necessary. This method will boost the first application launch progress.- See Also:
-
Process.myPid()
-