• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
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.
    • P Offline
      Pulsar33
      last edited by 31 Oct 2019, 08:49

      Thank you all for this subject !
      Is there a description (or source code) of the test_gps command somewhere, please ?
      BR
      Pulsar33

      Aquaris BQ E5 HD UBports OTA-25 (currently testing features)
      Aquaris BQ E5 HD Ubuntu Edition Canonical OTA-15 (last Canonical version, daily use)
      Raspberry Pi 4 B - 4 GB & 8 GB with various OS and Desktops (UBports not OK)

      D 1 Reply Last reply 31 Oct 2019, 09:35 Reply Quote 0
      • D Offline
        doniks @Pulsar33
        last edited by 31 Oct 2019, 09:35

        @Pulsar33 https://github.com/libhybris/libhybris/blob/master/hybris/tests/test_gps.c

        1 Reply Last reply Reply Quote 1
        • P Offline
          Pulsar33
          last edited by 31 Oct 2019, 23:03

          Excellent ! Thank you very much @doniks
          Best regards
          Pulsar33

          Aquaris BQ E5 HD UBports OTA-25 (currently testing features)
          Aquaris BQ E5 HD Ubuntu Edition Canonical OTA-15 (last Canonical version, daily use)
          Raspberry Pi 4 B - 4 GB & 8 GB with various OS and Desktops (UBports not OK)

          1 Reply Last reply Reply Quote 0
          • E Offline
            ernest
            last edited by 5 Nov 2019, 04:40

            Latest version has been uploaded to openstore.

            Please read prior use : https://github.com/ernesst/Utrack/blob/master/README.md

            1 Reply Last reply Reply Quote 0
            • A Offline
              aimar
              last edited by 31 Dec 2019, 19:14

              Hi all,
              I think this app is very useful.
              However, I can’t make it work.
              I use an Aquaris E4.5 with ubuntu 16.04 (OTA11).
              I used the previous script and now the recent updated script with no luck.
              I have no issues with the installation, but when I launch the script, it gets stuck with “Waiting for satellites ...”.
              When I close the app (Ctrl+C), it creates an empty gpx file.
              The rest of apps (ActivityTracker, OSMScout) fetch the data and show my position, so I am sure that GPS is working properly.
              What could be the cause?
              Thank you for your suggestions.
              aimar

              E 1 Reply Last reply 1 Jan 2020, 19:21 Reply Quote 0
              • E Offline
                ernest @aimar
                last edited by 1 Jan 2020, 19:21

                @aimar
                i noticed that the script is neither working with OP3 device. I had to modify it to make it works.
                Are you on telegram, if so please contact me @ern_st

                1 Reply Last reply Reply Quote 0
                • H Offline
                  hsce1
                  last edited by hsce1 20 Jun 2020, 18:02

                  Hi there,
                  Thank you @ernest for your work. Background GPS tracking is one of the features that I am missing most on Ubuntu Touch!

                  I tried to make it work on my XperiaX and my Nexus 4 but unfortunately without success. After a short while the following error is returned:

                  Waiting for satellites
                  
                  Traceback (most recent call last):
                    File "./Utrack.py", line 317, in <module>
                      read_gps(p)
                    File "./Utrack.py", line 219, in read_gps
                      if 70 > ACCURACY > 0 and len(longitude) > 0 and len(latitude) > 0:
                  TypeError: unorderable types: int() > list()
                  

                  Utrack_log.txt is empty but in the Utrack_tmp.txt I can see that the satellite data seemes to be logged correctly. The location is correct. I X'd out the exact position:

                  *** location callback
                  flags:  55
                  latitude:       50.XXXXX
                  longtide:       4.XXXXXX
                  accuracy:       23.000000
                  utc:    -758278816
                  

                  The error appears strange to me since none of the inputs is a list. Do you have a clue what to do?

                  1 Reply Last reply Reply Quote 0
                  • E Offline
                    ernest
                    last edited by ernest 20 Jun 2020, 18:23

                    Yes likely, it has register a list and now it tried to compare it with a int.

                    I've another version in WIP, that should fix that ...but has other bug. I'll try to find the click.

                    Edit : Try this one : https://drive.google.com/file/d/1I-_nGDVoFy5hdqiR_ApuA4hKCk8qmqSo/view?usp=sharing

                    H 1 Reply Last reply 22 Jul 2020, 15:48 Reply Quote 0
                    • H Offline
                      hsce1
                      last edited by 21 Jun 2020, 16:29

                      Hi @ernest!

                      Thank you for the quick response. Unfortunately I've another error now:

                      Traceback (most recent call last):
                        File "./Utrack.py", line 350, in <module>
                          read_gps(p)
                        File "./Utrack.py", line 177, in read_gps
                          event = event.decode("utf-8")
                      AttributeError: 'TailEvent' object has no attribute 'decode'
                      
                      E 1 Reply Last reply 21 Jun 2020, 18:17 Reply Quote 0
                      • E Offline
                        ernest @hsce1
                        last edited by 21 Jun 2020, 18:17

                        @hsce1 yep i've this thing once every 20 usage...I'll troubleshoot this summer.

                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          hsce1
                          last edited by 22 Jun 2020, 09:33

                          Thanks a lot for your work!!!

                          1 Reply Last reply Reply Quote 0
                          • H Offline
                            herr-b
                            last edited by herr-b 23 Jun 2020, 15:33

                            How did you get GPS tracking work? I got the program running in the terminal, but it seems to have no access to the GPS. The symbol in the indicator bar remains black.

                            In the description there are requirements mentioned (which I can not fullfill):

                            Depending of the Ubuntu Touch version and AppArmor security, you might need to run this app into an iperspace. See https://open-store.io/app/iperspace.emanuelesorce Currently RC and Stable requires this tool.

                            What do I have to do with this link/Information? I get a page: The app you are looking for has been removed or does not exist ...

                            E 1 Reply Last reply 23 Jun 2020, 20:38 Reply Quote 0
                            • E Offline
                              ernest @herr-b
                              last edited by 23 Jun 2020, 20:38

                              @herr-b You have to allow the terminal to run in background.
                              This app use test_gps which bypass Lomiri thus the icon color.

                              You can ran manuall in the terminal test_gps

                              However this app will likely not work for pinephone and Halium9.

                              1 Reply Last reply Reply Quote 0
                              • H Offline
                                herr-b
                                last edited by herr-b 24 Jun 2020, 13:04

                                @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 24 Jun 2020, 15:33

                                  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 24 Jun 2020, 20:08

                                    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 25 Jun 2020, 00:08

                                      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 27 Jun 2020, 08:26

                                        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 30 Jun 2020, 07:13

                                          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 22 Jul 2020, 15:48

                                            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
                                            • First post
                                              Last post