java.lang.Object |
↳ |
com.datalogic.device.app.AppManager |
Class Overview
AppManager
gives developers the ability to manage installed apllications.
Summary
Public Constructors |
|
AppManager(Context context)
This is the constructor of AppManager.
|
Public Methods |
int
|
addBatteryOptimizationExemption(String packageName)
Call this method to place the given application package on the device's power allowlist.
|
int
|
forceStopPackage(String packageName)
Call this method to stop an application.
|
int
|
grantAllPermissions(String packageName)
Call this method to grant an application all the permissions declared in its manifest.
|
int
|
grantPermissions(String packageName, ArrayList<String> permissions)
Call this method to grant an application the specified permissions.
|
int
|
removeBatteryOptimizationExemption(String packageName)
Call this method to remove the given application package from the device's power allowlist.
|
int
|
revokePermissions(String packageName, ArrayList<String> permissions)
Call this method to revoke an application the specified permissions.
|
int
|
setApplicationEnabledSetting(String packageName, int newState, int flags)
Call this method to set the enable setting for an application.
|
int
|
setApplicationHidden(String packageName, boolean hidden)
Call this method to hide or unhide packages.
|
int
|
setStatusBarDisabled(boolean disabled)
Call this method to disable or enable the status bar.
|
int
|
setUninstallBlocked(String packageName, boolean uninstallBlocked)
Change whether a user can uninstalling a package.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public Constructors
public
AppManager
(Context context)
This is the constructor of AppManager.
Parameters
context
| Context
The context of the calling app. |
Public Methods
public
int
addBatteryOptimizationExemption
(String packageName)
Call this method to place the given application package on the device's power allowlist.
Parameters
packageName
| String The name of the package to be added to the device's power allowlist. |
public
int
forceStopPackage
(String packageName)
Call this method to stop an application.
Parameters
packageName
| String The package name of the application to be force stopped. |
public
int
grantAllPermissions
(String packageName)
Parameters
packageName
| String The application to grant permissions to. |
public
int
grantPermissions
(String packageName, ArrayList<String> permissions)
Parameters
packageName
| String The application to grant permissions to. |
permissions
| ArrayList The list of permissions to be granted. |
public
int
removeBatteryOptimizationExemption
(String packageName)
Call this method to remove the given application package from the device's power allowlist.
Parameters
packageName
| String The name of the package to be removed from the device's power allowlist. |
public
int
revokePermissions
(String packageName, ArrayList<String> permissions)
Parameters
packageName
| String The application to revoke permissions to. |
permissions
| ArrayList The list of permissions to be revoked. |
public
int
setApplicationEnabledSetting
(String packageName, int newState, int flags)
Call this method to set the enable setting for an application.
Parameters
packageName
| String The package name of the application to enable. |
newState
| int The new enabled state for the application. |
flags
| int Optional behaviour flags.
Value is either 0 or a combination of android.content.pm.PackageManager#DONT_KILL_APP and
android.content.pm.PackageManager#SYNCHRONOUS. Not expected values in combinationation with these are ignored.
See for more details the Android documentation
PackageManager.setApplicationEnabledSetting(String packageName, int newState, int flags). |
public
int
setApplicationHidden
(String packageName, boolean hidden)
Call this method to hide or unhide packages.
If the package is already hide/unhide the method returns GENERIC_ERROR
.
Parameters
packageName
| String The name of the package to hide or unhide. |
hidden
| boolean True if the package should be hidden, false if it should be unhidden. |
public
int
setStatusBarDisabled
(boolean disabled)
Call this method to disable or enable the status bar.
Disabling the status bar blocks notifications and quick settings.
Parameters
disabled
| boolean True disables the status bar, false reenables it. |
public
int
setUninstallBlocked
(String packageName, boolean uninstallBlocked)
Change whether a user can uninstalling a package.
Parameters
packageName
| String The name of the package to change. |
uninstallBlocked
| boolean True if the user shouldn't be able to uninstall the package. |