labexp / osmtracker-android

GPS tracking tool for OpenStreetMap
GNU General Public License v3.0
503 stars 237 forks source link

Update of App does not track anymore. No track points. #279

Closed jamescr closed 3 years ago

jamescr commented 4 years ago

Version v1.0.0 Beta2. When I switch off hPa recording, then it is tracking. Switched on it does not track on my phone. I have a Samsung S5 (SM-G900F) with Lineage OS 16.0 (Android 9)


This message was sent by Ele van der Hoek via email

jamescr commented 4 years ago

@icrf2000 would you mind please help us checking this?

icrf2000 commented 4 years ago

Hello Ele van der Hoek,

Which is the exact commit that exhibits the bug? 1d07d1e07 I assume?

I just installed it on my Galaxy S10 and it tracks correctly, regardless of whether hPa logging is on or off (If off, of course there is no <baro> in the generated GPX).

Do I understand right that for you, with hPa set to ON, no points are recorded at all? Not only no <baro>, but really no points at all? As it works for me, but not for you, I have no immediate good idea. Maybe, if you upgraded from an older version which didn't have the hPa feature, your database is old and the trackpoint and waypoint tables do not contain the "atmospheric_pressure" column (the one marked in red in the screenshot below). In this case, I could imagine that an attempt to record a point with hPa info fails with an exception, causing no point at all.

osmtracker_DB_example

But I cannot reproduce this, so it is only a theory.

It could shed some light if you could provide a database export. Menu -> About -> Export Database. You then find a file OSMTracker.sqlitedb.gz in your tracks folder. ATTENTION: This file contains all your trackpoints, you might have privacy concerns and not want to share them publicly (this is also the reason why I blurred the Lat/Lon columns in my screenshot). If you are a developer, you can inspect the DB yourself, just open the OSMTracker.sqlitedb file in some DB browser (my screenshot shows it in the sqlitebrowser tool). Logcat lines could also help.

icrf2000 commented 4 years ago

Ok, in the meantime, I could reproduce the behavior.

As an immediate workaround, the reporter of the issue can simply deinstall the old app version and then install the new one. Maybe before deinstalling - to be sure the old DB is really deleted - clear the app cache and storage (Android -> Settings -> Apps -> osmtracker -> Storage; sorry, my mobile is in German, so I don't have the literal click path).

It is also easy to fix the code. I only must think about how to make a PR out of it, my local repo has diverged strongly from upstream in the meantime.

If it is urgent, here's a diff:

diff --git a/app/src/main/java/net/osmtracker/db/DatabaseHelper.java b/app/src/main/java/net/osmtracker/db/DatabaseHelper.java
index f838f68..15d53c7 100644
--- a/app/src/main/java/net/osmtracker/db/DatabaseHelper.java
+++ b/app/src/main/java/net/osmtracker/db/DatabaseHelper.java
@@ -124,7 +124,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
         *          TBL_WAYPOINT.COL_COMPASS and TBL_WAYPOINT.COL_COMPASS_ACCURACY
         *</pre>
         */
-       private static final int DB_VERSION = 16;
+       private static final int DB_VERSION = 17;^M

        public DatabaseHelper(Context context) {
                super(context, DB_NAME, null, DB_VERSION);
@@ -174,6 +174,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
                        db.execSQL("alter table " + TrackContentProvider.Schema.TBL_TRACKPOINT + " add column " + TrackContentProvider.Schema.COL_COMPASS_ACCURACY + " integer null");
                        db.execSQL("alter table " + TrackContentProvider.Schema.TBL_WAYPOINT + " add column " + TrackContentProvider.Schema.COL_COMPASS + " double null");
                        db.execSQL("alter table " + TrackContentProvider.Schema.TBL_WAYPOINT + " add column " + TrackContentProvider.Schema.COL_COMPASS_ACCURACY + " integer null");
+               case 16:^M
+                       db.execSQL("alter table " + TrackContentProvider.Schema.TBL_TRACKPOINT + " add column " + TrackContentProvider.Schema.COL_ATMOSPHERIC_PRESSURE + " double null");^M
+                       db.execSQL("alter table " + TrackContentProvider.Schema.TBL_WAYPOINT + " add column " + TrackContentProvider.Schema.COL_ATMOSPHERIC_PRESSURE + " double null");^M
                }

        }
jamescr commented 4 years ago

Ele van der Hoek sent me (via email) the DB and indeed there is no ATMOSPHERIC_PRESSURE column.

@icrf2000 Thanks for the help!

image