I am developing an android library and I want to apply a tamper-detection mechanism to my code, since it calls some sensitive financial web services.
What I'm going to implement is to calculate the checksum of the apk ( or important parts of it), programmatically on the runtime, so I can prevent a repackaged or recompiled apk from being able to do any harm (tamper prevention).
What I have come up with so far, is to calculate the checksum of the applicationInfo.publicSourceDir. but I'm not sure what happens with the apps that have multiple dex files or multiple splitApks.
What is the most reliable way to calculate checksum based on the code-base of an application in Android, programmatically?