@Override
        public void onOpen(final SQLiteDatabase db) {

            //get user version
            Log.iForce("[DB] Current Database Version: " + db.getVersion());

            if (firstRun) {
                sanityChecks(db);
                // limit number of records for trailHistory
                try {
                    db.execSQL("DELETE FROM " + dbTableTrailHistory + " WHERE _id < (SELECT MIN(_id) FROM (SELECT _id FROM " + dbTableTrailHistory + " ORDER BY _id DESC LIMIT " + MAX_TRAILHISTORY_LENGTH + "))");
                } catch (final Exception e) {
                    Log.w("Failed to clear trail history", e);
                }

                firstRun = false;
            }
        }
We override the default open/create as it doesn't work on OS 1.6 and
causes issues on other devices too.
main/src/main/java/cgeo/geocaching/storage/DataStore.java