Using appearance to launch an browser with ex:android.intent.action.VIEW

I am trying to use something like this…

ex:android.intent.action.VIEW(uri_data=concat('https://awebpage.com/api/?parameter=',${dynamic_value})

– in the appearance field to get data to a single form field from an external web app.

But I dont seem to be able to launch the default web browser.
Anyone who know how to?
J

Could you explain us a bit more so that the community would be able to look at it?

Thanks,
I started with this documentation Launching External Apps — ODK Docs
where the example here on specifying a URI
Launching External Apps — ODK Docs
uses SENDTO and DIAL to link to sms and telephone call and thought the same technique with VIEW could be used to access a web app to fetch data for a single field.

In the same way as the “url” appearance creates an “Open url” button to go to an external web app, I hoped that this solution, which creates a “Launch” button in Kobo/ODK Collect would enable me to return a value from a web app rather than use cut&paste as is needed when using the “url” appearance.



The XLSForm shows the two approaches tested

The problem I am trying to solve is this:
I have a small web app that converts GPS coordinates to PlusCodes in the same way that https://plus.codes/api?address=48.85,2.29 does. However, since the web app caches, it works offline in the field and enable surveyers to use the PlusCodes to share en ID based on this. With the “Open url” solution I can send the coordinates to the app and it returns a Pluscode to the clipboard but the user then needs to 1)close the web app, 2)paste the value into a text field. I was hoping that the method with ex:android.intent.action would enable me to remove this inconvenience and return the value without the manual paste operation.

Hi @Johs

Even if you get the browser to open using ex:intent, I doubt that it will send the return intent back to Collect. It would just display your converted value on the web page.
If you really must get this to work, you would need an app that is specifically designed to return the value back to collect.

But if you get it working somehow, do let me know. :slight_smile:

Hi, @ks_1
I am actually good at the the level you are describing, using the “url” appearance. The technique is

  1. Generate a url concatenating the form variables i need to send to the web app. This is displayed as the “Open Url” button to the user in KoboCollect
  2. The web app loads in the default browser and can be designed with a service worker to function offline with the data loaded when the KoboCollect user had network access.
  3. The web app returns the result that can be copied to the clipboard with a button, so the only step left to bring this data into the form is for the user to return to the form by closing the browser window or back-swipe and then use paste with the relevant input field.

With a few seconds of extra user interaction this is the best way I have found so far for adding advanced “helpers” and also dynamic KPI reporting and other tools to accompany Kobo/ODKCollect.