I am building an Android application that needs to keep track of some of the other applications installed on the device.
For a given application (package) I need to compute a hash values such that:
- The value is different for different versions of the same application
- The value is the same for the same version of the same application installed on different devices
Is there a way of doing this efficiently?
Thank you
Simply load the apk as a file and compute the MD5 hash of the file with:
Taken from: http://www.androidsnippets.com/create-a-md5-hash-and-dump-as-a-hex-string
Update:
Are you simply trying to see if a newer version of an App has been installed why not use the
PackageManager.getPackageInfomethod? It returns aPackageInfoobject that contains the version number of the application. You can track these values and when they change it means that an app has been updated. See this: http://developer.android.com/reference/android/content/pm/PackageManager.html