Auto-gps implementation on ODK Collect

Good evening,
if you allow me to get into your discussion I think Both would be very interesting ! For example, metadata to collect the prospection effort and data to locate the observation.

For those interested in the technical details of this conversation, Spec addition proposal: location preload has a proposal for the addition needed to the form specification.

If you have other comments about how it should work or the user experience, please comment here!

1 Like

+1 for the specs


+1 for the preload specs.

1 Like

Hello, sorry for the lack of activity on this feature, I have been very busy over the last 1.5 months because of change of jobs. Now, I am able to dedicate some time to finish this feature.

As of now, I have implemented the feature in the same way I described in my top post. I want to give the community something to test and give feedback on. Of course, I will change it later in accordance with what is decided for implementation. Hence, I have created an apk file and a sample form and uploaded it here for users to test auto-gps feature.

Please read the top post first. Download the attachment (.zip file) which contains the apk file and a sample form. Install the given apk and put in the sample form within the odk forms directory.

You can create your own form with question binding as "auto_gps" (make the question hidden) and use the same feature.

For Auto-gps settings, goto:
General Settings->Form management
At the bottom, you will have auto-gps settings, please change them according to need.

Please give feedback on the implementation here. (1.1 MB)

1 Like

I apologize for missing this message when you first posted it, @Raghu_Mittal! There is agreement for adding a new action to the XForms spec to support the feature. The behavior I'm imagining is that when the action is first triggered, the device will start a location request. Every time it gets a location update it will write the latest update to the node specified by ref. Once either a certain accuracy is reached (5m?) or a certain amount of time passes (20s?) the updates will stop. This could be configured at the device level which it looks like is what you've done @Raghu_Mittal.

The APK crashes on launch so I haven't been able to try your implementation, @Raghu_Mittal. Did you use a similar approach for writing the point out?

On the XLSForm side, we can start by only allowing a single GPS point collected this way and do it with a fixed type and name in the same way as other metadata:

@LN, it's strange that my apk crashes on launch. Can you try my code then? My fork of ODK Collect is on this link:
and the branch that contains my code is on "auto_gps_impl_demo1".
Using the code you should be able to generate the apk and test it. Let me know if you have any queries on my code/implementation.

1 Like

excellent, waiting for this feature.
i have read that this feature is available in surveyCTO and hope to see it in ODK

Super excited for this feature!

1 Like

Was looking for something like this.

Hi @AlexKaranja

it's not ready yet but it should be added in v1.19 which we want to release at the end of this month.

1 Like

Hi and thanks for the update. Looking forward to.

How much will we have to wait this feature?

The implementation itself is ready but we are waiting for xforms-spec. @yanokwa will we be able to do that in the upcoming release?

There are different ways to take on this auto-gps problem: in the audit log and in the form itself.

Background GPS in the audit log feature is finished and we are now waiting for changes in pyxform to be merged and released. I'm expecting we'll finish that and the docs for the next release of Collect (ETA Feb 24th).

Background GPS in the form is something we are going to do, but it takes time to do well. I'll update this issue when we have all the pieces in place.

With ODK Collect v1.20 Beta, you can now you track enumerator locations in the audit log. Please try it and offer your feedback in the beta topic.


Collecting the GPS coordinates in the background would be a fantastic feature added to ODK. Thanks for the work on adding the GPS capture to the audit log. Looking forward to the next release!


Thanks to all who have shared their ideas and needs on this thread and particularly to @Raghu_Mittal for the initial feature description.

ODK Collect v1.23 beta 1 was just released and includes a beta implementation of the feature. Please help us improve it by trying it! You can join the beta as described in this post and there is a test form available from the default server. This form will collect your location in the background and ask you about the properties of your location (indoors, city, etc).

As @Raghu_Mittal described, there are tradeoffs between location accuracy and battery consumption to consider. The current implementation leverages Android's fused location provider to balance the two. For each point that is collected, there is a 20 second timeout period. The data you collect with the sample form will guide whether changes need to be made to those decisions.

It is possible to collect background location not only when a form is opened but also when a particular value in the form changes. XLSForm support is not yet available but will be soon (see XLSForm spec proposal: auto-location type for background location capture with setlocation action).


Great Feature
Working very well
I am thankful to anyone who has done this thing


@LN tested auto GPS capturing features and it's working fine.