Skip to content
Nishant Srivastava edited this page Jul 16, 2016 · 5 revisions

Usage

Create an instance of PackageHunter

PackageHunter packageHunter = new PackageHunter(context);

Next call an available function on the packageHunter instance such as

String appName= packageHunter.getAppNameForPkg(packageName);

To get information from

Specific Package

To get information for a specific packageName , you have the following methods available to you

Value functionName returns
Application Name getAppNameForPkg(packageName) String
Version getVersionForPkg(packageName) String
Version Code getVersionCodeForPkg(packageName) String
First install time(ms) getFirstInstallTimeForPkg(packageName) long
Last update time(ms) getLastUpdatedTimeForPkg(packageName) long
Icon getIconForPkg(packageName) Drawable
All Permissions getPermissionForPkg(packageName) String[]
All Services getServicesForPkg(packageName) String[]
All Providers getProvidersForPkg(packageName) String[]
All Receivers getReceiverForPkg(packageName) String[]
All Activities getActivitiesForPkg(packageName) String[]

All Packages in Device

If you want to get the info about whole list of installed applications

ArrayList<PkgInfo> pkgInfoArrayList = packageHunter.getInstalledPackages()

which will provide you a list of PkgInfo objects each having

  1. Application Name
  2. Package Name
  3. Version
  4. Version Code
  5. First install time
  6. Last install time

Search for a Package

If you would instead like to search for a package which has a certain feature in all installed packages, you would have to call the below function with a flag.

ArrayList<PkgInfo> pkgInfoArrayList = packageHunter.searchInList(query, flag);

where flag can be

Flag Search in feature
PackageHunter.APPLICATIONS Application Name
PackageHunter.PACKAGES Package Name
PackageHunter.PERMISSIONS Permissions
PackageHunter.SERVICES Services
PackageHunter.RECEIVERS Receivers
PackageHunter.ACTIVITIES Activities
PackageHunter.PROVIDERS Providers

Checkout the sample app for demo.

Clone this wiki locally