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.
      • N Offline
        normandc @ernest
        last edited by

        @ernest said in GPS tracking in Background - Trick:

        @normandc said in GPS tracking in Background - Trick:
        To have the recording screen off, you have to enable with Tweak tool the option "Prevent suspend" for the terminal app.

        As I wrote, I already enabled this setting.

        One thing I didn't mention is that I don't have a SIM card in yet, my Android phone is still my main phone until I migrate everything to the OPO. I didn't have any Internet access. I since read that GPS localization seems to be more problematic without a SIM card.

        Check the new version, uploaded today, no more long list the screen is refreshed after each datapoint.
        I've also add a sum-up calculation at the end :

        GPX file Created : 1566872659557.gpx
        
            Length 2D: 0.004km
            Length 3D: 0.016km
            Moving time: 00:00:11
            Stopped time: 00:14:34
            Max speed: None
            Avg speed: 0m/s = 1km/h
            Total uphill: 3.3m
            Total downhill: 4.3m
        

        That sounds great, I'm back home and with still a week vacation left, I'm hoping to test this further. Thanks!

        I wonder, can we install Git on UT? It would make updating your script easier. I think I'll try and see.

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

          @normandc said in GPS tracking in Background - Trick:

          A word of warning: if you forget to activate the terminal's "prevent app suspension" button, once the script is launched, there is no stopping it!!! The CTRL+C button at the bottom will not stop the script.

          I meet the bug, doesn't appear on Edge but on Devel Yes.

          I'll look at it.

          1 Reply Last reply Reply Quote 0
          • N Offline
            normandc
            last edited by

            Sorry, I guess I should have mentioned I'm on 16.04/rc.

            BTW I tried to install git on UT, the package isn't available. I guess I could always git pull from my PC then copy to the phone, but I'm not seeing the gps-utouch-tracker folder from the PC, only the folders Documents, Music, Images and Videos...

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

              @normandc
              From the phone terminal,

              wget https://framagit.org/ernesst/gps-utouch-tracker/-/archive/master/gps-utouch-tracker-master.zip && unzip gps-utouch-tracker-master.zip
              
              N 1 Reply Last reply Reply Quote 0
              • N Offline
                normandc @ernest
                last edited by

                @ernest thanks, I guess keeping the original folder name (with -master) will make updating easier in the future.

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

                  All, i'm looking for good soul to test the last version, please contact me on Telegram : @Ernes_t

                  I've updated the script to : Consume less battery, import automatically the run to Activity Tracker when finished, upload the position in real-time to Phonetrack (Nextcloud) and distributed into a click.

                  I found recently thanks to iperspace, apparmor hack, the script should be able to run under all version.

                  1 Reply Last reply Reply Quote 1
                  • Pulsar33P Offline
                    Pulsar33
                    last edited by

                    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 Reply Quote 0
                    • D Offline
                      doniks @Pulsar33
                      last edited by

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

                      1 Reply Last reply Reply Quote 1
                      • Pulsar33P Offline
                        Pulsar33
                        last edited by

                        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

                          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

                            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 Reply Quote 0
                            • E Offline
                              ernest @aimar
                              last edited by

                              @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

                                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

                                  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 Reply Quote 0
                                  • H Offline
                                    hsce1
                                    last edited by

                                    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 Reply Quote 0
                                    • E Offline
                                      ernest @hsce1
                                      last edited by

                                      @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

                                        Thanks a lot for your work!!!

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

                                          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 Reply Quote 0
                                          • E Offline
                                            ernest @herr-b
                                            last edited by

                                            @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

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