From 8ade78aeb706c609815d4bd0c9347079fef5ca9e Mon Sep 17 00:00:00 2001 From: Balint Kovacs Date: Wed, 12 Jun 2013 10:34:36 +0200 Subject: [PATCH] Added version info in service startup log message Signed-off-by: Balint Kovacs --- src/hu/blint/ssldroid/SSLDroid.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/hu/blint/ssldroid/SSLDroid.java b/src/hu/blint/ssldroid/SSLDroid.java index 6ed2fef..01fca4c 100644 --- a/src/hu/blint/ssldroid/SSLDroid.java +++ b/src/hu/blint/ssldroid/SSLDroid.java @@ -3,7 +3,12 @@ package hu.blint.ssldroid; import hu.blint.ssldroid.TcpProxy; import android.app.*; import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; import android.database.Cursor; +import android.os.Build; +import android.os.Build.VERSION; import android.os.IBinder; import android.util.Log; import hu.blint.ssldroid.db.SSLDroidDbAdapter; @@ -61,7 +66,19 @@ public class SSLDroid extends Service { cursor.close(); dbHelper.close(); createNotification(0, true, "SSLDroid is running", "Started and serving "+tunnelcount+" tunnels"); - Log.d(TAG, "SSLDroid Service Started"); + //get the version + int vcode = 0; + String vname = ""; + PackageManager manager = this.getPackageManager(); + try { + PackageInfo pkginfo = manager.getPackageInfo(this.getPackageName(), 0); + vname = pkginfo.versionName; + vcode = pkginfo.versionCode; + } catch (NameNotFoundException e) { + Log.d(TAG, "Error getting package version; error='"+e.toString()+"'"); + } + //startup message + Log.d(TAG, "SSLDroid Service Started; version='"+vcode +"', versionname='"+vname+"'"); } @Override