Recent

Author Topic: FPC program for private gps logging on Android?  (Read 2328 times)

BosseB

  • Sr. Member
  • ****
  • Posts: 468
FPC program for private gps logging on Android?
« on: January 16, 2020, 04:27:35 pm »
I just want to know if it is possible without big effort to create a small GPS logging application for Android?
I just want it to log the phone position at some specified time interval to a local logfile.
All logging apps I have seen seem to use a server of some kind to process/store/display the data and this invades my privacy. A logger on the phone that just puts the data into a local file would be much more secure to use and I can then create a regular program with Lazarus to display the track if needed from the logged data.

I have looked for Android/Lazarus information but it all seems outdated, like this 3 years old tutorial page for example.
--
Bo Berglund
Sweden

john horst

  • Jr. Member
  • **
  • Posts: 68
    • JHorst
Re: FPC program for private gps logging on Android?
« Reply #1 on: January 16, 2020, 05:22:13 pm »
Without big effort? Unlikely as you will still have to learn how Android development works.   It's not hard to setup LAMW

john horst

  • Jr. Member
  • **
  • Posts: 68
    • JHorst
Re: FPC program for private gps logging on Android?
« Reply #2 on: January 16, 2020, 05:32:36 pm »
I will also say that this is easy enough with termux, termux-location and a simple shell script on android if you think fpc + android is overkill.

BosseB

  • Sr. Member
  • ****
  • Posts: 468
Re: FPC program for private gps logging on Android?
« Reply #3 on: January 16, 2020, 07:51:37 pm »
I will also say that this is easy enough with termux, termux-location and a simple shell script on android if you think fpc + android is overkill.
Well, what I really am looking for is a way to get GPS positions logged to a file at regular intervals.
On a Linux machine I would probably do something like:
- Install GPSD
- Configure it to save the position once a minute or so to a file.
or
- Create a cron task running once a minute that:
- reads the NMEA output until the proper message is found
- writes that message to disk in a log file

In both cases I would use Lazarus to create a visual display of the "track" of the phone.
And no external entity will be involved, thus privacy ensured.

Anyway, thanks for your suggestion for termux! It seems from its homepage like it can co-operate with Tasker...
I have Tasker installed for other purposes and it might just be able to do what I need, provided I can trust it to not have backdoor access points from the makers of Tasker...

So I will try Tasker for my tracker log project.
--
Bo Berglund
Sweden

otoien

  • Jr. Member
  • **
  • Posts: 89
Re: FPC program for private gps logging on Android?
« Reply #4 on: January 17, 2020, 02:50:21 am »
Not in Lazarus, but I have found the open-source Android app called GPS-Logger that works very well and is very accurate. (You might find multiple apps called by that name - this one has red and black screens and an icon as a red dot with a grey ring with notches around it, probably illustrating a compass).
https://play.google.com/store/apps/details?id=eu.basicairdata.graziano.gpslogger&hl=en_US

It does not depend on any servers, logging is all local to your phone. It can export TXT, GPX and KML files. If desired, one can also export files to Google Earth to get a snapshot of the route and current location while underway. If I have pre-loaded/cached the zoomed in Earth maps of the area I am in, that works even without any data connection on the phone while out in the field.

On the PC I have found open source GPXSee great for reviewing the GPX files on a real topographic map.
https://www.gpxsee.org/

« Last Edit: January 17, 2020, 03:07:46 am by otoien »
Unless otherwise noted I always use the latest stable version of Lasarus/FPC x86_64-win64-win32/win64

BosseB

  • Sr. Member
  • ****
  • Posts: 468
Re: FPC program for private gps logging on Android?
« Reply #5 on: January 17, 2020, 04:02:27 pm »
Thanks, I installed GPS Logger and tried it out.
It seems to be geared towards recording tracks, you start it and begin logging and then end the logging and then you can export to some format files. Exercise tracks and the like with limited duration.
I walked 3.66 km for 48 min and the resulting files were 400k (gpx) and 107 kb (kml) respectively. They contain a lot of info, more than I want and in xml format too...

I am looking for a function that can be on constantly and log at more spaced out intervals to a csf file format. Possibly also check the closeness of points to not log the same point over and over. Something I could accomplish if I could program for Android directly...
--
Bo Berglund
Sweden

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: FPC program for private gps logging on Android?
« Reply #6 on: January 17, 2020, 04:48:18 pm »
I don't know whether it's the same but there is an open-source GPS Logger from which you might get some ideas.

Googling for "GPS Logger" might bring you more like that.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

BosseB

  • Sr. Member
  • ****
  • Posts: 468
Re: FPC program for private gps logging on Android?
« Reply #7 on: January 18, 2020, 05:48:23 pm »
I don't know whether it's the same but there is an open-source GPS Logger from which you might get some ideas.

Googling for "GPS Logger" might bring you more like that.
Thanks!

I tested this too (GPS Logger for Android) and it seems like it is doing what I want with config for:
- Logging running all the time while keeping battery drain low
- Setting the time interval between log entries
- Setting the accuracy for logging an entry
- Setting min distance between logged positions (makes log NOT fill up with entries when the phone is not moving)
- Setting log format to CSV text
- And lots more I have yet to test.

So it seems to do what I need and the open-source type makes it possible to check for back doors too.
No need to re-invent it!

And no need to dive into Tasker to create a logging task there.
« Last Edit: January 18, 2020, 05:50:26 pm by BosseB »
--
Bo Berglund
Sweden

 

TinyPortal © 2005-2018