public class AppManager
extends java.lang.Object
AppManager gives developers the ability to manage installed apllications.
| Constructor and Description |
|---|
AppManager(android.content.Context context)
This is the constructor of AppManager.
|
| Modifier and Type | Method and Description |
|---|---|
int |
forceStopPackage(java.lang.String packageName)
Call this method to stop an application.
|
int |
grantAllPermissions(java.lang.String packageName)
Call this method to grant an application all the permissions declared in its manifest.
|
int |
grantPermissions(java.lang.String packageName,
java.util.ArrayList<java.lang.String> permissions)
Call this method to grant an application the specified permissions.
|
int |
setApplicationEnabledSetting(java.lang.String packageName,
int newState,
int flags)
Call this method to set the enable setting for an application.
|
int |
setApplicationHidden(java.lang.String packageName,
boolean hidden)
Call this method to hide or unhide packages.
|
int |
setUninstallBlocked(java.lang.String packageName,
boolean uninstallBlocked)
Change whether a user can uninstalling a package.
|
public AppManager(android.content.Context context)
context - Context
The context of the calling app.AppManagerException - in case of error, when exceptions are enabled through the ErrorManager singleton.public int grantAllPermissions(java.lang.String packageName)
packageName - StringThe application to grant permissions to.int
AppManagerException.SUCCESS in case of success,
otherwise a possible error code, matching one of the AppManagerException error constants.AppManagerException - in case of error, when exceptions are enabled through the ErrorManager singleton.public int grantPermissions(java.lang.String packageName,
java.util.ArrayList<java.lang.String> permissions)
packageName - Stringhe application to grant permissions to.permissions - ArrayList list of permissions to be granted.int
AppManagerException.SUCCESS in case of success,
otherwise a possible error code, matching one of the AppManagerException error constants.AppManagerException - in case of error, when exceptions are enabled through the ErrorManager singleton.public int forceStopPackage(java.lang.String packageName)
packageName - StringThe package name of the application to be force stopped.int
AppManagerException.SUCCESS in case of success,
otherwise a possible error code, matching one of the AppManagerException error constants.AppManagerException - in case of error, when exceptions are enabled through the ErrorManager singleton.public int setApplicationEnabledSetting(java.lang.String packageName,
int newState,
int flags)
packageName - StringThe package name of the application to enable.newState - intThe new enabled state for the application.flags - intOptional behaviour flags.
Value is either 0 or a combination of android.content.pm.PackageManager#DONT_KILL_APP and
android.content.pm.PackageManager#SYNCHRONOUS.int
AppManagerException.SUCCESS in case of success,
otherwise a possible error code, matching one of the AppManagerException error constants.AppManagerException - in case of error, when exceptions are enabled through the ErrorManager singleton.public int setUninstallBlocked(java.lang.String packageName,
boolean uninstallBlocked)
packageName - StringThe name of the package to change.uninstallBlocked - booleanTrue if the user shouldn't be able to uninstall the package.int
AppManagerException.SUCCESS in case of success,
otherwise a possible error code, matching one of the AppManagerException error constants.AppManagerException - in case of error, when exceptions are enabled through the ErrorManager singleton.public int setApplicationHidden(java.lang.String packageName,
boolean hidden)
packageName - StringThe name of the package to hide or unhide.hidden - booleanTrue if the package should be hidden, false if it should be unhidden.int
AppManagerException.SUCCESS in case of success,
otherwise a possible error code, matching one of the AppManagerException error constants.AppManagerException - in case of error, when exceptions are enabled through the ErrorManager singleton.