1

I want to perform a code operation only under the assumption that the current build is a signed APK. Is there a way to programmatically find out?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Cookienator
  • 637
  • 1
  • 7
  • 25
  • Could this be the answer? https://stackoverflow.com/questions/32954404/verifying-an-apk-programmatically-using-jarsigner – Daniel Mar 07 '18 at 15:13

2 Answers2

0

You can check to see if you're running a debug build with BuildConfig.DEBUG. If this shows up as false, you're on a release build. For example:

if (BuildConfig.DEBUG) {
    Log.d(TAG, "This is a debug build");
} else {
    Log.d(TAG, "This is a release build");
}
rjr-apps
  • 352
  • 4
  • 13
0

PackageInfo.signatures contains the array of all signatures read from the package file. This can be obtained using PackageManager.getInstalledPackages() with GET_SIGNATURES flag.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134