External Call google maps intent fails

1. What is the problem? Be very detailed.
I am trying to call Google maps to get address based on reverse geocoding of latitude and longitude.
I have hard-coded coordinates in the example to just test the behaviour.

When I try to get external data from google maps based on https://docs.getodk.org/launch-apps-from-collect/#external-apps-to-populate-multiple-fields (I assume maps return multiple values)

I get the message "the requested application is missing. Please manually enter the reading".
Also, I am not able to populate field City manually. No keyboard launches and I only see label "City"

2. What app or server are you using and on what device and operating system? Include version numbers.
I have tried multiple devices with latest ODK collect from Google play.
I think this is Android device issue, app server should be irrelevant for this.

3. What you have you tried to fix the problem?
Changing android.intent.action.ACTION_VIEW to
android.intent.action.VIEW launches browser
android.intent.action.DIAL launches phone so I think nothing is wrong with external app launch mechanism.

4. What steps can we take to reproduce the problem?
Create project with attached form and try to enter the data!
GoogleMapsIntentDemo.xlsx (9.8 KB)

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

I am Android newbie so could be that I misunderstood external intent configuration from ODK
Not completely sure about the syntax for URI that I use here.

Also, Google recommends using Maps URLs - but I don't see ODK support for this.


at least brings Maps up - I am still trying to figure out weather maps return some values and how to get them.

Seems it will not work. Google Geocoding API has to be used for this.

I think the best solution would be to add intent to ODK collect (similar to org.opendatakit.counter from https://docs.getodk.org/launch-apps-from-collect/?highlight=external) that would invoke required API and return desired data.

It will take me a while ... :slight_smile:

Hi @etoimene
We're glad you're here. When you get a chance, please introduce yourself on this forum thread. I'd also encourage you to add a real picture as your avatar because it helps build community!

It is not possible to use our external widgets for this purpose because they expect to receive intents with values as described in the documentation. It's our spec and if you want to send something back from an external app to Collect you need to follow it (prepare that external app). Google Maps of course doesn't do that.

What you want to achieve would require building a new widget I think, that wouldn't call external apps but just get addresses using the api something like https://stackoverflow.com/questions/9409195/how-to-get-complete-address-from-latitude-and-longitude

@Grzesiek2010, thanks for the idea.
I am looking for the solution for local geological institute to collect data for their observations.
It is very often away from civilization, so offline ODK collect functionality looks promising.
Sorry, no real picture on the Net.

I didn't find any widget building documentation. I guess I should get my hands dirty with source code. :slight_smile:

I was actually thinking adding function here - https://getodk.github.io/xforms-spec/#xpath-functions.

That would allow me to use it in XLSForm specification (I hope), but looks a bit too deep for such relatively simple modification.

Other would be to add intent to ODK collect with that lookup functionality and then use standard ex: mechanism (I am not sure does Android allow this - one application to call it's own intent).

I was able to execute URLs that return JSON - I guess it shouldn't be too complicated to extract only one attribute from that JSON. Just don't know where.
I am a bit new to this so ...

I think I creating an external app that would work with our external widgets would be a good solution it would let you avoid touching the original repo (ODK Collect).

I agree. I thought about that. That would make me manage two applications.

It would be a good example of how people can use our external widgets so if you create it maybe you can publish it on github and here on the forum in Showcase?

Thanks for info about it. I would gladly put it in showcase.
I was investigating a bit and I think I'll go fork route with one app to manage.

Not set on it yet.

Whatever is better for you. If you want to have one app you can implement it as a separate module in your fork of ODK Collect and also publish.