3

There are 3 types of apps in android

  1. Android System apps
  2. Apps installed from Android Play Store
  3. Apps installed through local apk (usually installed by developers or any other source)

I get the 1st category of apps packages (i.e. System apps) using code below

private boolean isSystemPackage(ResolveInfo ri) {
return (ri.activityInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
}

I want to get packages of 2nd category of apps on Android Device (i.e. Apps installed from Android Play Store)....please tell me how do i get that?

Even if i get local installed apps (i.e. 3rd category) then i can also find my solution by ignoring 1st and 3rd category of apps packages from all packages....

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Navjot
  • 1,202
  • 1
  • 11
  • 24

1 Answers1

2

You should use getInstallerPackageName, it retrieves the package name of the application that installed a package. This identifies which market the package came from:

http://developer.android.com/reference/android/content/pm/PackageManager.html#getInstallerPackageName%28java.lang.String%29

For the Play Store, you should check if it comes from com.android.vending!

thiagolr
  • 6,909
  • 6
  • 44
  • 64
  • The getInstallerPackageName is not a reliable call because the value returned is not reliable and can be easily fudged using the following command: "adb install -i some.apk" – lohith Mar 14 '14 at 06:30