• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help Create GPS Log, save to file, transmit when possible

RobSue

Newbie
I have a need to create a GPS log for a Samsung Tab A that will practically always be left in a vehicle and on charge (hence battery drain is not really an issue). What I need it to do is record the GPS location to a file of some sort at regular intervals then transmit that information to the office when it connects to WiFi.

My thought is to create some sort of Profile that will trigger every 5 or 10 minutes, plus every time the screen is activated by the user, and have that launch a task that will record the GPS location, date, time to a csv file.

I then need another profile that will either email that file, or transfer it to Drive or DropBox when connected to WiFi so it can be transferred to the office.

Is this doable? Any suggestions?
 
I think there are apps that address many of the requirements you identified.

What is the purpose of this app? Track an untrustworthy employee? Theft protections?

One app ... Cerberus – paid – remotely track your phone – remote Factory Data Reset – remotely take picture, copy text message log, display message
Cerberus (Android) enable capability on device
Cerberus (Website) control device from website

It allows you to access the location history of the phone from your desktop computer. You can download the log and review it with Goggle Earth.

If the phone is root-ed you can give the installed app a special permission that will allow you to toggle location on/off from your desktop. For what you have said I imagine location will always be on.

There are I am sure other apps with other solutions.

If you choose to develop something with Tasker you can bounce Tasker questions through this forum.

What have you developed so far?

... Thom
 
Thanks Thom. I will have a look at the product you suggested, though I don't want to root the units.

<<What is the purpose of this app? >>
We currently use a rented tracking unit on each vehicle at $148.50 per month. I want to, instead, track the phones. All staff are equipped with company owned iPhones and I think they have the capacity to enable tracking of current position quite easily.

At times, however, we need to look back to see where they've been some days - they forget to record it or enter the wrong data in our logging system. Therefore I thought I would simply put a logging app in the Android Tablet that they have in the vehicles. It's used to prepare Job Safety Analyses which are saved to the unit and automatically transfer to the office when they connect to WiFi. I thought if I wrote a Tasker app to record where the Android unit is every x minutes, and every time they activate it, that should do. I can easily write something that will create a csv file and save the GPS location, but what I don't know is how to save it on a folder that will replicate when connected to WiFi, say a Google Drive folder.

Then it dawned on me that there may be a better, or pre-implemented solution that I could use; hence this question
 
Thom, had a look at Cerberus and it looks great. The video says it costs one-time $4 but when I look at their forum to confirm the current price it's full of complaints about them changing away from a one-time license. Obviously I don't mind paying but I am now waiting to see how much they're charging as I can't find their price anywhere on the web site.

At any rate, is there a way to save a csv file on a DropBox or Google Drive folder, in case I opt for the Tasker option. Getting it to write to a csv file at regular intervals seems like a 5 minute job.
 
What have you developed so far?

Getting it to write to a csv file at regular intervals seems like a 5 minute job.

You have yet to answer the question I asked.

Your observation about how much time it will take ... if you can do it in 5 minutes what are you asking about?

You have conflicting requirements. You wan t this to collect data when there is no Internet connection and you also say you want to write the data to a cloud file.

You need to write the data to a local file and in a separate Task transmit it to some external location.

This Tasker task writes employee Harry , date, time, and location every 10 minutes to a local file ...

DevE (630)
A1: Variable Set [ Name:%emp To:Harry Recurse Variables:Off Do Maths:Off Append:Off ]
<Location Loop>
A2: Get Location [ Source:Any Timeout (Seconds):10 Continue Task Immediately:Off Keep Tracking:Off ]
A3: Variable Set [ Name:%loc To:%LOC Recurse Variables:Off Do Maths:Off Append:Off ]
A4: Variable Split [ Name:%loc Splitter:, Delete Base:Off ]
A5: Write File [ File:tlaNET-int/data/location.csv Text:%emp,%DATE,%TIME,%loc1,%loc2 Append:On Add Newline:On ]
A6: Variable Set [ Name:%txt To:%emp
%DATE -- %TIME
Lat: %loc1
Lon: %loc2 Recurse Variables:Off Do Maths:Off Append:Off ]
A7: Flash [ Text:%txt Long:On ]
A8: Wait [ MS:0 Seconds:0 Minutes:10 Hours:0 Days:0 ]
A9: Goto [ Type:Action Label Number:1 Label:Location Loop ]

... Thom
 
Last edited:
Have a look at "FolderSync" and "Autosync for Dropbox - DropSync" apps, they might help you too.

Emailing won't be hard either ;)
 
The amount of data he is collecting is so small (<10K/day) he could collect it in a single file and email it to his office once a month.

... Thom
 
To answer the earlier question, all I have done is a lot of research on both Android and Apple platforms, no coding yet.

The 5 minute job was going to be something similar (though not even as detailed) as Thom presented. I didn't want to reinvent the wheel if there was something already out there that handled what I need + more. I think what Thom has presented will enable me to create a Task that will record the data very easily. I thought it may be best to figure out how to save it to DropBox or Drive but your emailing idea seems good too. I will hunt around to see how to do that.

Thanks for your help, and your patience.
 
Tasker is different. It is like a collection of macros where some can be tailored and some can not. It takes time to learn.

My recommend approach is to start out small. Get it working. Add too it. Repeat the approach. Grow it to its final form.

... Thom
 
Last edited:
Thanks Thom. I am trying.

What makes it even more interesting is that I am finding there are a lot of different ways for doing things and power consumption is an added complication. e.g. your suggested Task above is built on a Task with an endless loop with a Wait xx minutes. It could have been built around a profile that repeats every xx minutes. But which uses less power? Unfortunately that added complication also gives rise to more questions, which to an accomplished programmer may sound stupid.
 
My object was to make it as simple as possible to show how it could be done. Putting the date in the filename automatically would result in a separate file for each day.

For testing I used 1 min and the minimum for a profile is 2 min.

There is a thread at the top of this forum with a lot of Tasker code. A good place to get ideas.

... Thom
 
Last edited:
Thanks Thom. In the end I created a Profile that runs from 5AM to 11:59PM and every 10 minutes it runs the logging Task.

In turn the task saves the location with a Google Maps prefix, along with date, time, etc into a csv file. That means the column can be copy/pasted into a browser to see the location (I haven't figured out how to make a Google Maps link with a list of coordinates so it will display the lot) but this is adequate.

The task also checks if it's a new day (against a saved variable) and, if it is, it updates the date variable, emails the csv file to me and deletes the csv file.

I am testing now but if that all works then it's doing what I need.

Again I appreciate your help.
 
I think you will find that both approaches eat battery. That is the result of leaving Location on. There is a plug in that allows you to toggle Location. Drawback is that Tasker with plug in must be installed on device doing the sampling.

On interesting feature of timing with a profile... if you don't set start time and tell it every 10 min it ignites on 0, 10, 20, 30, 40, and 50.

... Thom
 
Last edited:
Fortunately these devices can be left powered most of the time.

Not sure i understand your comments. Does the profile triggered every 10 minutes use more power than your suggestion of using a wait 10 minutes in an endless loop?
 
Both of them use a lot of battery. I don't know which uses the most. Leaving Location on for 9.5min in each 10min period also consumes battery.

Since you are always connected to a charger I don't know why you would care.

... Thom
 
Back
Top Bottom