public class AppMgmtUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.io.FilenameFilter |
APK_FilenameFilter |
static java.lang.String |
REPO_INDEX_FILENAME
Name of repo index file
|
static java.lang.String |
REPOZ_INDEX_FILENAME
Name of compressed index file
|
Constructor and Description |
---|
AppMgmtUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getAppDescription(android.content.Context context,
java.lang.String packageName)
Gets the description of the application described by the package name.
|
static android.graphics.drawable.Drawable |
getAppDrawable(android.content.Context context,
java.lang.String packageName)
Get the drawable for the apk.
|
static android.content.pm.ApplicationInfo |
getAppInfo(android.content.Context context,
java.lang.String packageName)
Gets the app information for an application described by the package name
|
static java.lang.String |
getAppNameOrPackage(android.content.Context context,
java.lang.String packageName)
Given a packageName return the application name
|
static int |
getAppVersionCode(android.content.Context context,
java.lang.String pkg)
Obtains the app version code from an application described by the package name
|
static java.lang.String |
getAppVersionName(android.content.Context context,
java.lang.String pkg)
Gets the version name of an application described by the package name.
|
static android.graphics.drawable.Drawable |
getDialogIcon(android.content.Context context,
android.graphics.drawable.Drawable image)
Given a drawable, get a scaled drawable useful for the dialog box
|
static android.graphics.drawable.Drawable |
getDialogIcon(android.content.Context context,
android.graphics.drawable.Drawable image,
float size)
Scale image to a specified size
Used to display alert dialog icons at a reasonable, consistent size.
|
static android.graphics.drawable.Drawable |
getDialogIcon(android.graphics.drawable.Drawable image,
float size)
Deprecated.
|
static long |
getInstalledDate(android.content.Context context,
java.lang.String pkgname)
Gets the install date of an application described by the package name.
|
static java.lang.String[] |
getSignatureInfo(android.content.Context context,
java.lang.String pkgname)
Obtain the Signatures information of an application described by the package name.
|
static long |
getUpdateDate(android.content.Context context,
java.lang.String pkgname)
Gets the update date of an application described by the package name.
|
static boolean |
install(android.content.Context context,
java.io.File apk)
Installs an APK in ATAK.
|
static java.lang.Boolean |
isActivityRunning(java.lang.Class<?> activityClass,
android.content.Context context) |
static boolean |
isAppRunning(android.content.Context context,
java.lang.String processName)
pings the activity processes registered in the currently running manifest
if night vision app is registered it is currently running
|
static boolean |
isInstalled(android.content.Context context,
java.lang.String pkg)
Checks is the package name is registered in the device package manager ie installed apk
|
boolean |
isRunning(android.content.Context ctx) |
static void |
uninstall(android.content.Context ctx,
java.lang.String packageName)
Given a package name, request android to start uninstalling
|
public static final java.lang.String REPO_INDEX_FILENAME
public static final java.lang.String REPOZ_INDEX_FILENAME
public static final java.io.FilenameFilter APK_FilenameFilter
public static boolean install(android.content.Context context, java.io.File apk)
context
- the context to use for the install processapk
- the apk pointed to by the file.public static java.lang.String getAppNameOrPackage(android.content.Context context, java.lang.String packageName)
context
- the context to usepackageName
- the package namepublic static android.graphics.drawable.Drawable getAppDrawable(android.content.Context context, java.lang.String packageName)
context
- the context to usepackageName
- the package namepublic static android.graphics.drawable.Drawable getDialogIcon(android.content.Context context, android.graphics.drawable.Drawable image, float size)
image
- Drawablesize
- Desired size in pixels
It's recommended to pass in a dimension resource here rather
than a hardcoded sizepublic static android.graphics.drawable.Drawable getDialogIcon(android.content.Context context, android.graphics.drawable.Drawable image)
context
- the context to useimage
- the original drawable@Deprecated public static android.graphics.drawable.Drawable getDialogIcon(android.graphics.drawable.Drawable image, float size)
getDialogIcon(Context, Drawable, float)
image
- Bitmap drawablesize
- Desired size in pixels
It's recommended to pass in a dimension resource here rather
than a hardcoded sizepublic static android.content.pm.ApplicationInfo getAppInfo(android.content.Context context, java.lang.String packageName)
context
- the context to usepackageName
- the package name to resolvepublic static int getAppVersionCode(android.content.Context context, java.lang.String pkg)
context
- the context to usepkg
- the package name to resolvepublic static java.lang.String getAppVersionName(android.content.Context context, java.lang.String pkg)
context
- the context to usepkg
- the package name to resolvepublic boolean isRunning(android.content.Context ctx)
public static void uninstall(android.content.Context ctx, java.lang.String packageName)
ctx
- the context to usepackageName
- the package name to resolve *public static boolean isInstalled(android.content.Context context, java.lang.String pkg)
context
- the context to usepkg
- the manifest package name that is associated with the applicationpublic static long getInstalledDate(android.content.Context context, java.lang.String pkgname)
context
- the context to usepkgname
- the package name to resolvepublic static long getUpdateDate(android.content.Context context, java.lang.String pkgname)
context
- the context to usepkgname
- the package name to resolvepublic static java.lang.String[] getSignatureInfo(android.content.Context context, java.lang.String pkgname)
context
- the context to usepkgname
- the package name to resolvepublic static boolean isAppRunning(android.content.Context context, java.lang.String processName)
public static java.lang.Boolean isActivityRunning(java.lang.Class<?> activityClass, android.content.Context context)
public static java.lang.String getAppDescription(android.content.Context context, java.lang.String packageName)
context
- the context to usepackageName
- the package name to resolve