External app - help with intent syntax

I have been struggling for days to understand the ODK collect external app
widget (http://opendatakit.org/help/form-design/external-apps/). I am a
Android and javarosa noob, so any help suggestion would be appreciated.

My setup is;

  • Mobile device: Kobo Touch N905C (Touchscreen, Wifi only)
  • Android 2.3.4
  • ODK Collect v1.4.3 rev 1042.apk
  • ConnectBot v1.7.1
  • Raspberry Pi (Raspian)

I want to click a button in an ODK collect form that opens a specific
ConnectBot ssh connection;

  • ConnectBot has been pre-setup with a ssh connection+commands, when the
    connection is selected it makes a ssh connection to a Raspberry Pi on a
    internal wifi network and in the terminal of the pi sends a command to run
    a python script that collects images using the Raspberry pi camera,
    processes them and saves them to the pi's internal memory.
  • the ssh url is
    ssh://pi@1.1.1.1:22/#sidepicam
  • I then use the "choose image" widget to select the image (via an sftp
    connection, using ES file explorer) and store it with the ODK form.

All goes well except I cannot work out the syntax for including the correct
intent in my form;

The Intent when connecting to the specific ssh url
Intent { act=android.intent.action.VIEW dat=ssh://pi@1.1.1.1:22/#sidepicam
flg=0x4000000 cmp=org.connectbot/.ConsoleActivity }

  • Using the breathTest.xml example I edited to;
    <h:body>

    Is the child having difficulty breathing?
    Yestrue
    Nofalse




    </h:body>

  • The intent returned by ODK collect is;
    Intent { act=android.intent.action.VIEW cmp=android/com.android.internal.
    app.ResolverActivity (has extras) }

This opens a list dialogue with options to pick various apps, but not
ConnectBot

I think I am not using the correct syntax to pass the
dat=ssh://pi@1.1.1.1:22/#sidepicam
option to the intent. Please could someone correct me.

Note at this stage just being able to open the external app from ODK
collect would be sufficient.

cheers Ed.

Ed,

What happens if you remove "dat=" from the command? So something like..

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Thu, Jul 31, 2014 at 6:42 AM, edward.morris.1976@gmail.com wrote:

I have been struggling for days to understand the ODK collect external app
widget (http://opendatakit.org/help/form-design/external-apps/). I am a
Android and javarosa noob, so any help suggestion would be appreciated.

My setup is;

Mobile device: Kobo Touch N905C (Touchscreen, Wifi only)
Android 2.3.4
ODK Collect v1.4.3 rev 1042.apk
ConnectBot v1.7.1
Raspberry Pi (Raspian)

I want to click a button in an ODK collect form that opens a specific
ConnectBot ssh connection;

ConnectBot has been pre-setup with a ssh connection+commands, when the
connection is selected it makes a ssh connection to a Raspberry Pi on a
internal wifi network and in the terminal of the pi sends a command to run a
python script that collects images using the Raspberry pi camera, processes
them and saves them to the pi's internal memory.
the ssh url is
ssh://pi@1.1.1.1:22/#sidepicam
I then use the "choose image" widget to select the image (via an sftp
connection, using ES file explorer) and store it with the ODK form.

All goes well except I cannot work out the syntax for including the correct
intent in my form;

ConnectBot manifest
https://github.com/connectbot/connectbot/blob/master/AndroidManifest.xml
Info on intents with ConnectBot
http://stackoverflow.com/questions/8315011/using-connectbot-with-intents
The intent from the log on my Android device when I open ConnectBot
Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] flg=0x10200000
cmp=org.connectbot/.HostListActivity bnds=[198,259][313,374] }

The Intent when connecting to the specific ssh url
Intent { act=android.intent.action.VIEW dat=ssh://pi@1.1.1.1:22/#sidepicam
flg=0x4000000 cmp=org.connectbot/.ConsoleActivity }
Using the breathTest.xml example I edited to;
<h:body>

Is the child having difficulty breathing?
Yestrue
Nofalse




</h:body>

The intent returned by ODK collect is;
Intent { act=android.intent.action.VIEW
cmp=android/com.android.internal.app.ResolverActivity (has extras) }

This opens a list dialogue with options to pick various apps, but not
ConnectBot

I think I am not using the correct syntax to pass the
dat=ssh://pi@1.1.1.1:22/#sidepicam
option to the intent. Please could someone correct me.

Note at this stage just being able to open the external app from ODK collect
would be sufficient.

cheers Ed.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yaw,

No apparent change. The same app chooser list comes up and the intent in
log is "Intent { act=android.intent.action.VIEW
cmp=android/com.android.internal.app.ResolverActivity (has extras) }".

I am not sure how I can view the Extras in the intent from ODK collect.

In Terminal Emulator;

am start -a android.intent.action.VIEW ssh://pi@1.1.1.1:22/#pi@sidepicam;
Opens chooser list with ConnectBot and returns in log "Intent {
act=android.intent.action.VIEW
cmp=android/com.android.internal.app.ResolverActivity (has extras) }"
i.e., it works correctly, however replacing "start" with "startservice" or
"broadcast" returns no service found.

Ed

Hi Ed,

Dug around in the code a little bit and it looks like that data
doesn't get passed through. it's a shortcoming of the implementation.

I've filed a bug
https://code.google.com/p/opendatakit/issues/detail?id=1040. Please
"Star" it if you want to be notified of any changes for this issue. No
ETA for a fix.

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Thu, Jul 31, 2014 at 3:25 PM, edward.morris.1976@gmail.com wrote:

Yaw,

No apparent change. The same app chooser list comes up and the intent in log
is "Intent { act=android.intent.action.VIEW
cmp=android/com.android.internal.app.ResolverActivity (has extras) }".

I am not sure how I can view the Extras in the intent from ODK collect.

In Terminal Emulator;

am start -a android.intent.action.VIEW ssh://pi@1.1.1.1:22/#pi@sidepicam;
Opens chooser list with ConnectBot and returns in log "Intent {
act=android.intent.action.VIEW
cmp=android/com.android.internal.app.ResolverActivity (has extras) }"
i.e., it works correctly, however replacing "start" with "startservice" or
"broadcast" returns no service found.

Ed

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.