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?
Asked
Active
Viewed 106 times
1
-
Could this be the answer? https://stackoverflow.com/questions/32954404/verifying-an-apk-programmatically-using-jarsigner – Daniel Mar 07 '18 at 15:13
2 Answers
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
-
The question is about signed/unsigned. not about release or debug. – Sreekanth Karumanaghat Apr 08 '20 at 09:14
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