In this post you will have to find how to get the all version details and date of creation of particular APK file.
So from that you can access the details of one of your app with other app.Its very easy to do this just follow the following steps.
Step 1) Add your apk(that you want the details) in your sdcard or the folder you want.
Step 2) Add the following code in your activity.
ZipFile zf;
final PackageManager pm = getPackageManager();
//Name of your apk file that you want details
String apkName = "yourappname.apk";
//Give it to the path of your apk file
String fullPath = Environment.getExternalStorageDirectory()
+ "/" + apkName;
PackageInfo info = pm.getPackageArchiveInfo(fullPath, 0);
try {
zf = new ZipFile(fullPath);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ZipEntry ze = zf.getEntry("classes.dex");
long time = ze.getTime();
String s = SimpleDateFormat.getInstance().format(
new java.util.Date(time));
Step 3)Just display your all details.
Toast.makeText(this,"VersionCode : " + info.versionCode + ",
VersionName : " + info.versionName + ",
App Creation Date : " + s,
Toast.LENGTH_LONG).show();
Thanks..Android rocks..:)
So from that you can access the details of one of your app with other app.Its very easy to do this just follow the following steps.
Step 1) Add your apk(that you want the details) in your sdcard or the folder you want.
Step 2) Add the following code in your activity.
ZipFile zf;
final PackageManager pm = getPackageManager();
//Name of your apk file that you want details
String apkName = "yourappname.apk";
//Give it to the path of your apk file
String fullPath = Environment.getExternalStorageDirectory()
+ "/" + apkName;
PackageInfo info = pm.getPackageArchiveInfo(fullPath, 0);
try {
zf = new ZipFile(fullPath);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ZipEntry ze = zf.getEntry("classes.dex");
long time = ze.getTime();
String s = SimpleDateFormat.getInstance().format(
new java.util.Date(time));
Step 3)Just display your all details.
Toast.makeText(this,"VersionCode : " + info.versionCode + ",
VersionName : " + info.versionName + ",
App Creation Date : " + s,
Toast.LENGTH_LONG).show();
Thanks..Android rocks..:)


