UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    GPS tracking in Background - Edge Hack (Not Devel, Stable, RC)

    Scheduled Pinned Locked Moved App Development
    38 Posts 9 Posters 7.3k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • H Offline
        herr-b
        last edited by herr-b

        @ernest Yes I already allowed the terminal to run in the background.
        test_gps shows 'init gps interface' and the program shows 'Waiting for satellites' but both get no position, while Pure Maps has GPS reception and shows the position on the map. Foreground or background doesnt matter. It looks like the terminal does not get access to the GPS?
        I switched from stable to RC without any change. I use it on a BQ Aquaris E4.5 Ubuntu Edition.

        1 Reply Last reply Reply Quote 0
        • E Offline
          ernest
          last edited by

          Try to let the phone outside for 5-10 min.
          If test_GPS doesn't work for you, then my app will not work.

          1 Reply Last reply Reply Quote 0
          • H Offline
            herr-b
            last edited by

            GPS reception is not the problem, the app Activity Tracker is working and recording. I switched now the Activity Tracker to run in the background and it seems to keep running in the background. So I can navigate with Pure Maps in the foreground and record the track in the background. But as soon as the screen gets locked all the apps are stopped? Not sure, I will keep testing ... but if I play music in the Web Browser and the screen locks, also the music stops.
            It looks that in the case the UT phone should be my only phone I will have to reactivate good old Garmin Foretrex 401 for track recording.

            1 Reply Last reply Reply Quote 0
            • E Offline
              ernest
              last edited by

              Yes app not in foreground doesn't get GPS signal, see my request there : https://github.com/ubports/ubuntu-touch/issues/1067

              1 Reply Last reply Reply Quote 0
              • H Offline
                herr-b
                last edited by

                I can't confirm this. I allowed Activity Tracker to run in the background in UT Tweak Tool and started track recording in Activity Tracker. Then I started Pure Maps to navigate and switched apps from time to time. Most of the time I had Pure Maps in the foreground. At the end I had a complete track in Activity Tracker.

                So this means, that Activity Tracker has GPS reception and works in the background (if allowed in UT Tweak Tool) in my case.

                1 Reply Last reply Reply Quote 0
                • H Offline
                  herr-b
                  last edited by

                  Another test showed again the problem with the locked screen. In my test Activity Tracker did not continue recording, once the GPS reception was lost shortly in a building, also GPS reception should have been good again after the interruption. Only after unlocking the screen it continued track recording.

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    hsce1 @ernest
                    last edited by hsce1

                    Hi @ernest,

                    I just had a look at the Utrack.py and made the following change (line 183), which made the code run on my phone:

                    if re.search("^longtide", line): #longtide bug in test_gps
                        try:
                            long = line.split()
                    -       if re.match(".\d+.\d+", long[1]):
                    +       if re.match("(?:\d+(?:\.\d*)?|\.\d+)", long[1]):
                                longitude = long[1]
                            else:
                                subprocess.Popen(["truncate", "-s", "0", temp_file], shell=False)
                    

                    You are trying to match a floating point number here, right? Following this post it is apparently better to use "(?:\d+(?:\.\d*)?|\.\d+)". I've made a pull request.

                    I hope this does not break other things. On the my phone it works..

                    Here is the click if someone wants to test:
                    https://drive.google.com/file/d/1AADkOrVwV-YvTo00XtHnC997e3gRNIi0/view?usp=sharing

                    Best,
                    Hendrik

                    1 Reply Last reply Reply Quote 0
                    • E Offline
                      ernest
                      last edited by

                      Thanks for the pull request,
                      I'll not be able to test it prior end of august 😕 (My goods and spare phone are in transit).

                      Let see the feedback of others.

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        hsce1
                        last edited by

                        For me the fix seems to work. I am travelling by bike since more than a week and a combination of OSM Scout Server, Pure Maps and Utrack does a very good job guiding and tracking me. The error did not occur again.

                        However, I realized that two fuctionalities would improve Utrack a lot:

                        • Automatic saving of the track every few minutes in order not to loose the hard work of a day once the battery dies 😄
                        • A possibility for pausing/resuming the tracking

                        Do you think this would be possible without deteriorating the battery performance?

                        1 Reply Last reply Reply Quote 0
                        • E Offline
                          ernest
                          last edited by

                          Thanks for testing, I got back my Nexus 5. I should be able to look at it soon.

                          The aim of this wrapper was to enable simple GPS background tracking, but not pretending to have a full feature app. I'm not going to add functionality on a "hack" even working. It would be better to enable on Utouch the GPS background then we could start thinking on improving apps (like Activity Tracker).
                          We need visibility there : https://github.com/ubports/ubuntu-touch/issues/1067

                          1 Reply Last reply Reply Quote 0
                          • M Offline
                            Marcos
                            last edited by

                            Guys, I tested the last version from the OpenStore. Once I launch the script it indicates is searching for satellites but does not get the position so generates an empty gpx. If I run test_gps, it gives a "segmentation fault" message. However, GPS works (very) fine in other applications (GPS tracker or uNav). I' m on Volla RC. Any idea why the script is not working? I assume something related to halium or so but not really sure.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post