Skip to content

Commit

Permalink
feat(software): add install date
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelje authored and Hector Rondon committed Nov 7, 2017
1 parent 06cd986 commit 13ae1a1
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ public Software(Context xCtx) {
Category c = new Category("SOFTWARES", "softwares");

c.put("NAME", new CategoryValue(getName(p), "NAME", "name"));
c.put("VERSION", new CategoryValue(getVersion(p), "NAME", "name"));
c.put("VERSION", new CategoryValue(getVersion(p), "VERSION", "VERSION"));
c.put("FILESIZE", new CategoryValue(getFilesize(p), "FILESIZE", "fileSize"));
c.put("FROM", new CategoryValue(FROM, "FROM", "from"));
c.put("INSTALLDATE", new CategoryValue(getInstallDate(p), "INSTALLDATE", "installDate"));

this.add(c);
}
Expand All @@ -129,6 +130,24 @@ public String getName(ApplicationInfo p) {
return mName;
}

/**
* Get the version of the application
* @param ApplicationInfo p
* @return string the application version
*/
public String getInstallDate(ApplicationInfo p) {
String mInstalled = "";

try {
PackageInfo pi = packageManager.getPackageInfo(p.packageName, PackageManager.GET_META_DATA);
mInstalled = String.valueOf(pi.firstInstallTime);
} catch (NameNotFoundException e) {
FILog.e(e.getMessage());
}

return mInstalled;
}

/**
* Get the version of the application
* @param ApplicationInfo p
Expand Down

0 comments on commit 13ae1a1

Please sign in to comment.