Copy: Send "calculate" data to clipboard from a collect form

1. What is the problem? Be very detailed.
I need sample xlsform to effectively copy data from within form. I think share to external app feature may work. External app will be clipboard in android i think.

2. What app or server are you using and on what device and operating system? Include version numbers.
Android samsung galaxy S7. ODK central 1.2
GDrive also

3. What you have you tried to fix the problem?
I do not know the syntax. So i am looking for a sample form as this is not clear to me from the ODK documentation. This needs to be a general solution.

4. What steps can we take to reproduce the problem?
Add data to a calculate variable and send to clipboard effectively copying the data. So the user cam paste it in app of their choice.

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

I hope someone can respond to this basic question please.

Hi @alios82,

The documentation about external applications in ODK is here. It is supposed you should have some knowledge about intents in Android and the use of extras.
Your external apk should have some lines in AndroidManifest.xml like this:


where com.something.app.textMsg is the name that you have to use in xlsform:

text=${textoIN} is the parameter or Extra.
Extra it is a variable in the code that receives the data. Something like the below code:

Result is return as "value" (lines 53 to 57 image above) and it is the answer to the question that call the external apk.

I hope it could be useful as the sample you requested

2 Likes

Thank you so much Alexander.
I have a starting point with your example. I was able to scour the forum and make SMS work using intents successfully.

I am not too good with deep tech but am learning. I will absorb and try this using your sample. Much appreciated.

Quick question: would android wide copy (or paste) have a standardized reference like "com.something.clipboard" and an extra ?

Sorry I do not know.

Thanks Alexander for your feedback.
I had a quick look online. I suppose in absence of generic filter or activity in android for clipboard data item for copy/paste action is not generically available. So this will not be implementable as a generic solution for all android devices.

However one may be able to send data implicitly to clipboard manager as an extra for "android.content.Intent.ACTION_SEND"

The .....send may pass it forward to an application (e.g. clipboard manager or sms or text editor) that exposes intents in its android manifest.

This may facilitate generic solution for passing text to many app in end users' ecosystem.
Apoligies for broken tech understanding above.

Could you advise along these lines also ?

Sorry, I do not know about that.