--- android/CheckUpdates/src/dk/thoerup/checkupdates/CheckUpdates.java 2010/05/10 19:45:11 721 +++ android/CheckUpdates/src/dk/thoerup/checkupdates/CheckUpdates.java 2010/05/10 19:55:13 722 @@ -22,7 +22,7 @@ public class CheckUpdates { public static long TIMESPAN_DAY = 24*60*60*1000; // one day - final static String PREFS = "CheckUpdate"; + final static String CHECKUPDATES = "CheckUpdates"; int versionCode; String versionName; @@ -39,7 +39,7 @@ this.context = context; this.title = title; - SharedPreferences prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE); + SharedPreferences prefs = context.getSharedPreferences(CHECKUPDATES, Context.MODE_PRIVATE); long lastCheck = prefs.getLong("lastcheck", 0); long now = System.currentTimeMillis(); //should i use android.os.SystemClock.elapsedRealtime() instead ? @@ -63,9 +63,8 @@ task.execute(url); - } catch (NameNotFoundException e) { - e.printStackTrace(); + Log.e(CHECKUPDATES, "NamingException", e); } } @@ -90,7 +89,7 @@ result = true; } catch (Exception e) { - Log.e("CheckUpdates", "Check for " + packageName + " failed!", e); + Log.e(CHECKUPDATES, "Check for " + packageName + " failed!", e); } return null; @@ -121,7 +120,7 @@ protected void onPostExecute(Void r) { super.onPostExecute(r); - Log.i("CheckUpdates", "result=" + result + ", newestVersion" + newestVersion + ", versionCode=" + versionCode); + Log.i(CHECKUPDATES, "result=" + result + ", newestVersion" + newestVersion + ", versionCode=" + versionCode); if (result == true) { if (newestVersion > versionCode) { @@ -135,7 +134,7 @@ try { context.startActivity(i); } catch (Exception e) { - Log.e("CheckUpdates", "Activity launch failed", e); + Log.e(CHECKUPDATES, "Activity launch failed", e); } context = null; @@ -150,14 +149,14 @@ try { builder.show(); } catch (Exception e) { - Log.e("CheckUpdates", "Builder.show failed", e); + Log.e(CHECKUPDATES, "Builder.show failed", e); } } long now = System.currentTimeMillis(); - SharedPreferences prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE); + SharedPreferences prefs = context.getSharedPreferences(CHECKUPDATES, Context.MODE_PRIVATE); //when done write Editor edit = prefs.edit(); edit.putLong("lastCheck", now);