Jaytjuh Jaytjuh - 26 days ago 10
Android Question

Android app get last date updated

Is it possible to get the date when the app was last updated?
I want to show it in the app like this:

String htmltext = "E-mail: " + Datacontainer.Instance().GetDatabaseHelper().GetUserEmail() +
"<br>Authorized: " + is_auth +
"<br>Last updated on: " + "?" +
"<br>Tips version: " + "228" +
"<br>App version: " + "v 1.3.0" +
"<br>Your Airline: " + "?" +
"<br>Your Nickname: " + "?" +
"<br>No of tips submitted: " + "?";

TextView infotext = (TextView)fragmentView.findViewById(R.id.infotext);
infotext.setText(Html.fromHtml(htmltext));

Answer

Try this :

PackageManager pm = context.getPackageManager();
ApplicationInfo appInfo = pm.getApplicationInfo("app.package.name", 0);
String appFile = appInfo.sourceDir;
long installed = new File(appFile).lastModified(); //Epoch Time