-
-
Notifications
You must be signed in to change notification settings - Fork 26
Usage
Nishant Srivastava edited this page Jul 16, 2016
·
5 revisions
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 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[] |
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
- Application Name
- Package Name
- Version
- Version Code
- First install time
- Last install time
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.