diff --git a/src/org/fdroid/fdroid/FDroidApp.java b/src/org/fdroid/fdroid/FDroidApp.java index eb8ead6b9..5b6b543fb 100644 --- a/src/org/fdroid/fdroid/FDroidApp.java +++ b/src/org/fdroid/fdroid/FDroidApp.java @@ -25,6 +25,7 @@ import java.util.concurrent.Semaphore; import android.app.Application; import android.util.Log; +import android.content.Context; public class FDroidApp extends Application { @@ -43,7 +44,9 @@ public class FDroidApp extends Application { icon_path.mkdir(); apps = null; - DB.initDB(getApplicationContext()); + Context ctx = getApplicationContext(); + DB.initDB(ctx); + UpdateService.schedule(ctx); } diff --git a/src/org/fdroid/fdroid/UpdateService.java b/src/org/fdroid/fdroid/UpdateService.java index 3d30dc670..4b9f44bba 100644 --- a/src/org/fdroid/fdroid/UpdateService.java +++ b/src/org/fdroid/fdroid/UpdateService.java @@ -56,9 +56,8 @@ public class UpdateService extends IntentService implements ProgressListener { } // Schedule (or cancel schedule for) this service, according to the - // current preferences. Should be called a) at boot, or b) if the preference - // is changed. - // TODO: What if we get upgraded? + // current preferences. Should be called a) at boot, b) if the preference + // is changed, or c) on startup, in case we get upgraded. public static void schedule(Context ctx) { SharedPreferences prefs = PreferenceManager @@ -76,7 +75,11 @@ public class UpdateService extends IntentService implements ProgressListener { alarm.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + 5000, AlarmManager.INTERVAL_HOUR, pending); + Log.d("FDroid", "Update scheduler alarm set"); + } else { + Log.d("FDroid", "Update scheduler alarm not set"); } + } protected void sendStatus(int statusCode ) {