Calling Intents using Android App Callout

Hi,

I am using the Android App Callout to test using intents

I am struggling with the syntax and could do with a hand.
I am using the build in alarm as an example.

Intent ID: android.intent.action.SET_ALARM

Extra
android.intent.extra.alarm.MESSAGE Wakey Wakey
android.intent.extra.alarm.HOUR 12
android.intent.extra.alarm.MINUTES 23

The app wont install as soon as I add the Extras.

I have tried just the shortened MESSAGE, HOUR and MINUTES.

Would it be possible to have a simple example of the correct syntax for
Intents including the Response using one of the Standard Android intents
and to another App?

Much thanks in advance

Tim

Tim,

Form builder expects the values to be paths to data rather than hard coded
values. So, these either need to be the paths to a question or, more
likely, a hidden value with a calculate expression of the proper value.

For example, your extra key might be:

android.intent.extra.alarm.MESSAGE

And the value would be:

/data/hidden_value_1

With hidden_value_1 having the calculate expression ‘Wakey Wakey’

I can see our documentation isn’t clear enough on that point and I’ll fix
that shortly - sorry about that.

Thanks,
Will

··· On Tue, Aug 12, 2014 at 12:50 PM, Tim Butler wrote:

Hi,

I am using the Android App Callout to test using intents

I am struggling with the syntax and could do with a hand.
I am using the build in alarm as an example.

Intent ID: android.intent.action.SET_ALARM

Extra
android.intent.extra.alarm.MESSAGE Wakey Wakey
android.intent.extra.alarm.HOUR 12
android.intent.extra.alarm.MINUTES 23

The app wont install as soon as I add the Extras.

I have tried just the shortened MESSAGE, HOUR and MINUTES.

Would it be possible to have a simple example of the correct syntax for
Intents including the Response using one of the Standard Android intents
and to another App?

Much thanks in advance

Tim


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

Hi

With Will’s advice I have now got the following working:

Intent ID: com.xxxxxxx.android.app.INTENTCALL

Extra:
IntentVariable1 > /data/HiddenIntVar1
IntentVariable2 > /data/HiddenIntVar2

where /data/HiddenIntVar1 and /data/HiddenIntVar2 are populated from the
form.

I am struggling on the response:
ResponseVariable1 > /data/HiddenResVar1

Am I missing something?

Best

Tim

··· On Tuesday, August 12, 2014 5:50:21 PM UTC+1, Tim Butler wrote: > > Hi, > > I am using the Android App Callout to test using intents > > I am struggling with the syntax and could do with a hand. > I am using the build in alarm as an example. > > Intent ID: android.intent.action.SET_ALARM > > Extra > android.intent.extra.alarm.MESSAGE Wakey Wakey > android.intent.extra.alarm.HOUR 12 > android.intent.extra.alarm.MINUTES 23 > > The app wont install as soon as I add the Extras. > > I have tried just the shortened MESSAGE, HOUR and MINUTES. > > Would it be possible to have a simple example of the correct syntax for > Intents including the Response using one of the Standard Android intents > and to another App? > > Much thanks in advance > > Tim > > > >

I have now got the Called App to return a string to another dummy program.
So now launches the program, scans the value and responds with a single
string.

When I launch with CommCare ODK the program, scans the value and then
crashes ODK with the following message:
08-22 10:03:18.735: E/AndroidRuntime(13771): java.lang.RuntimeException:
Failure delivering result ResultInfo{who=null, request=10, result=-1,
data=Intent { (has extras) }} to activity
{org.xxxxx.demolog/org.odk.collect.android.activities.FormEntryActivity}:
java.lang.NullPointerException

Here is the code

Intent resultIntent = new Intent();
resultIntent.putExtra(“BarCodes”, single_barcode);
setResult(RESULT_OK, resultIntent);
finish();

In Commcare

Response BarCodes > /data/returnData

Am I missing something? Anyone else had some experience of this?

Much thanks in advance

Tim

··· On Wednesday, August 20, 2014 9:22:22 AM UTC+1, Tim Butler wrote: > > Hi > > With Will's advice I have now got the following working: > > Intent ID: com.xxxxxxx.android.app.INTENTCALL > > Extra: > IntentVariable1 > /data/HiddenIntVar1 > IntentVariable2 > /data/HiddenIntVar2 > > where /data/HiddenIntVar1 and /data/HiddenIntVar2 are populated from the > form. > > I am struggling on the response: > ResponseVariable1 > /data/HiddenResVar1 > > Am I missing something? > > Best > > Tim > > > > > > On Tuesday, August 12, 2014 5:50:21 PM UTC+1, Tim Butler wrote: >> >> Hi, >> >> I am using the Android App Callout to test using intents >> >> I am struggling with the syntax and could do with a hand. >> I am using the build in alarm as an example. >> >> Intent ID: android.intent.action.SET_ALARM >> >> Extra >> android.intent.extra.alarm.MESSAGE Wakey Wakey >> android.intent.extra.alarm.HOUR 12 >> android.intent.extra.alarm.MINUTES 23 >> >> The app wont install as soon as I add the Extras. >> >> I have tried just the shortened MESSAGE, HOUR and MINUTES. >> >> Would it be possible to have a simple example of the correct syntax for >> Intents including the Response using one of the Standard Android intents >> and to another App? >> >> Much thanks in advance >> >> Tim >> >> >> >>

Tim,

CommCareODK actually expects either a single string value with key
odk_intent_data and a value that that question will be set to and/or a
Bundle called odk_intent_bundle with a set of key-value pairs, as specified
at the bottom of this page
https://bitbucket.org/commcare/commcare-odk/wiki/ODKActivityCallout. So
your code here will actually look like:

Intent resultIntent = new Intent();Bundle extras = new Bundle();
extras.putString(“BarCodes”,single_barcode);
setResult(RESULT_OK, resultIntent);
finish();

Best,
Will

··· On Fri, Aug 22, 2014 at 5:32 AM, Tim Butler wrote:

I have now got the Called App to return a string to another dummy program.
So now launches the program, scans the value and responds with a single
string.

When I launch with CommCare ODK the program, scans the value and then
crashes ODK with the following message:
08-22 10:03:18.735: E/AndroidRuntime(13771): java.lang.RuntimeException:
Failure delivering result ResultInfo{who=null, request=10, result=-1,
data=Intent { (has extras) }} to activity
{org.xxxxx.demolog/org.odk.collect.android.activities.FormEntryActivity}:
java.lang.NullPointerException

Here is the code

Intent resultIntent = new Intent();
resultIntent.putExtra(“BarCodes”, single_barcode);
setResult(RESULT_OK, resultIntent);
finish();

In Commcare

Response BarCodes > /data/returnData

Am I missing something? Anyone else had some experience of this?

Much thanks in advance

Tim

On Wednesday, August 20, 2014 9:22:22 AM UTC+1, Tim Butler wrote:

Hi

With Will’s advice I have now got the following working:

Intent ID: com.xxxxxxx.android.app.INTENTCALL

Extra:
IntentVariable1 > /data/HiddenIntVar1
IntentVariable2 > /data/HiddenIntVar2

where /data/HiddenIntVar1 and /data/HiddenIntVar2 are populated from the
form.

I am struggling on the response:
ResponseVariable1 > /data/HiddenResVar1

Am I missing something?

Best

Tim

On Tuesday, August 12, 2014 5:50:21 PM UTC+1, Tim Butler wrote:

Hi,

I am using the Android App Callout to test using intents

I am struggling with the syntax and could do with a hand.
I am using the build in alarm as an example.

Intent ID: android.intent.action.SET_ALARM

Extra
android.intent.extra.alarm.MESSAGE Wakey Wakey
android.intent.extra.alarm.HOUR 12
android.intent.extra.alarm.MINUTES 23

The app wont install as soon as I add the Extras.

I have tried just the shortened MESSAGE, HOUR and MINUTES.

Would it be possible to have a simple example of the correct syntax for
Intents including the Response using one of the Standard Android intents
and to another App?

Much thanks in advance

Tim


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

Sorry about the somewhat confusing behavior in this regard.

It’s not extremely common for applications to maintain a callout contract
that is tremendously generic in some regards, and we didn’t want to force
collisions through people’s standard app callouts. This behavior is
currently functional but still something we’re open to adapting. If you
have comments on how you’d like the intent callout structure to work, feel
free to either email here or make comments on our wiki at

Thanks!
-Clayton

··· On Fri, Aug 22, 2014 at 5:41 AM, William Pride wrote:

Tim,

CommCareODK actually expects either a single string value with key
odk_intent_data and a value that that question will be set to and/or a
Bundle called odk_intent_bundle with a set of key-value pairs, as specified
at the bottom of this page
https://bitbucket.org/commcare/commcare-odk/wiki/ODKActivityCallout. So
your code here will actually look like:

Intent resultIntent = new Intent();
Bundle extras = new Bundle();
extras.putString(“BarCodes”,single_barcode);
setResult(RESULT_OK, resultIntent);
finish();

Best,
Will

On Fri, Aug 22, 2014 at 5:32 AM, Tim Butler tim.butler.88@gmail.com wrote:

I have now got the Called App to return a string to another dummy
program. So now launches the program, scans the value and responds with a
single string.

When I launch with CommCare ODK the program, scans the value and then
crashes ODK with the following message:
08-22 10:03:18.735: E/AndroidRuntime(13771): java.lang.RuntimeException:
Failure delivering result ResultInfo{who=null, request=10, result=-1,
data=Intent { (has extras) }} to activity
{org.xxxxx.demolog/org.odk.collect.android.activities.FormEntryActivity}:
java.lang.NullPointerException

Here is the code

Intent resultIntent = new Intent();
resultIntent.putExtra(“BarCodes”, single_barcode);
setResult(RESULT_OK, resultIntent);
finish();

In Commcare

Response BarCodes > /data/returnData

Am I missing something? Anyone else had some experience of this?

Much thanks in advance

Tim

On Wednesday, August 20, 2014 9:22:22 AM UTC+1, Tim Butler wrote:

Hi

With Will’s advice I have now got the following working:

Intent ID: com.xxxxxxx.android.app.INTENTCALL

Extra:
IntentVariable1 > /data/HiddenIntVar1
IntentVariable2 > /data/HiddenIntVar2

where /data/HiddenIntVar1 and /data/HiddenIntVar2 are populated from the
form.

I am struggling on the response:
ResponseVariable1 > /data/HiddenResVar1

Am I missing something?

Best

Tim

On Tuesday, August 12, 2014 5:50:21 PM UTC+1, Tim Butler wrote:

Hi,

I am using the Android App Callout to test using intents

I am struggling with the syntax and could do with a hand.
I am using the build in alarm as an example.

Intent ID: android.intent.action.SET_ALARM

Extra
android.intent.extra.alarm.MESSAGE Wakey Wakey
android.intent.extra.alarm.HOUR 12
android.intent.extra.alarm.MINUTES 23

The app wont install as soon as I add the Extras.

I have tried just the shortened MESSAGE, HOUR and MINUTES.

Would it be possible to have a simple example of the correct syntax for
Intents including the Response using one of the Standard Android intents
and to another App?

Much thanks in advance

Tim


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


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

Hi Clayton and Will

I got there in the end with Will's patience and help.

The Response was held in this code

@Override
public void onBackPressed() {

// Bundle
Intent resultIntent = new Intent();
Bundle extras = new Bundle();
// "CommCareResponse1" can be any name you choose and is used to catch the
repsonse in CommCare
extras.putString("CommCareResponse1", programVariable1);
extras.putString("CommCareResponse2", programVariable1);
resultIntent.putExtra("odk_intent_bundle", extras);
setResult(RESULT_OK, resultIntent);
finish();
super.onBackPressed();

}

Clayton, I think clearer step by step examples would have helped me a lot.
As this is passing between programs, it takes a little time to ensure that
both the send and receive work in both CommCare and the created app.

I also expected to be able to get response from any program api not just
ones I can code myself. Not that much of an issue in this case but would be
if we wanted to interface with other mainstream programs.

The last little thing is naming the button. It would be useful to be able
to modify this through your interface.

For the record, it is working now and we have a real barcode scanner
grabbing 1D barcodes in a split second on a rugged handset :slight_smile:

Best

Tim

··· On Friday, August 22, 2014 4:22:25 PM UTC+1, Clayton Sims wrote: > > Sorry about the somewhat confusing behavior in this regard. > > It's not extremely common for applications to maintain a callout contract > that is tremendously generic in some regards, and we didn't want to force > collisions through people's standard app callouts. This behavior is > currently functional but still something we're open to adapting. If you > have comments on how you'd like the intent callout structure to work, feel > free to either email here or make comments on our wiki at > > http://github.com/dimagi/commcare-odk > > Thanks! > -Clayton > > > On Fri, Aug 22, 2014 at 5:41 AM, William Pride <wpr...@dimagi.com > wrote: > >> Tim, >> >> CommCareODK actually expects either a single string value with key >> odk_intent_data and a value that that question will be set to and/or a >> Bundle called odk_intent_bundle with a set of key-value pairs, as specified >> at the bottom of this page >> . >> So your code here will actually look like: >> >> Intent resultIntent = new Intent(); >> Bundle extras = new Bundle(); >> extras.putString("BarCodes",single_barcode); >> setResult(RESULT_OK, resultIntent); >> finish(); >> >> Best, >> Will >> >> >> On Fri, Aug 22, 2014 at 5:32 AM, Tim Butler <tim.bu...@gmail.com > wrote: >> >>> >>> I have now got the Called App to return a string to another dummy >>> program. So now launches the program, scans the value and responds with a >>> single string. >>> >>> When I launch with CommCare ODK the program, scans the value and then >>> crashes ODK with the following message: >>> 08-22 10:03:18.735: E/AndroidRuntime(13771): java.lang.RuntimeException: >>> Failure delivering result ResultInfo{who=null, request=10, result=-1, >>> data=Intent { (has extras) }} to activity >>> {org.xxxxx.demolog/org.odk.collect.android.activities.FormEntryActivity}: >>> java.lang.NullPointerException >>> >>> Here is the code >>> >>> Intent resultIntent = new Intent(); >>> resultIntent.putExtra("BarCodes", single_barcode); >>> setResult(RESULT_OK, resultIntent); >>> finish(); >>> >>> In Commcare >>> >>> Response BarCodes > /data/returnData >>> >>> Am I missing something? Anyone else had some experience of this? >>> >>> Much thanks in advance >>> >>> Tim >>> >>> >>> On Wednesday, August 20, 2014 9:22:22 AM UTC+1, Tim Butler wrote: >>>> >>>> Hi >>>> >>>> With Will's advice I have now got the following working: >>>> >>>> Intent ID: com.xxxxxxx.android.app.INTENTCALL >>>> >>>> Extra: >>>> IntentVariable1 > /data/HiddenIntVar1 >>>> IntentVariable2 > /data/HiddenIntVar2 >>>> >>>> where /data/HiddenIntVar1 and /data/HiddenIntVar2 are populated from >>>> the form. >>>> >>>> I am struggling on the response: >>>> ResponseVariable1 > /data/HiddenResVar1 >>>> >>>> Am I missing something? >>>> >>>> Best >>>> >>>> Tim >>>> >>>> >>>> >>>> >>>> >>>> On Tuesday, August 12, 2014 5:50:21 PM UTC+1, Tim Butler wrote: >>>>> >>>>> Hi, >>>>> >>>>> I am using the Android App Callout to test using intents >>>>> >>>>> I am struggling with the syntax and could do with a hand. >>>>> I am using the build in alarm as an example. >>>>> >>>>> Intent ID: android.intent.action.SET_ALARM >>>>> >>>>> Extra >>>>> android.intent.extra.alarm.MESSAGE Wakey Wakey >>>>> android.intent.extra.alarm.HOUR 12 >>>>> android.intent.extra.alarm.MINUTES 23 >>>>> >>>>> The app wont install as soon as I add the Extras. >>>>> >>>>> I have tried just the shortened MESSAGE, HOUR and MINUTES. >>>>> >>>>> Would it be possible to have a simple example of the correct syntax >>>>> for Intents including the Response using one of the Standard Android >>>>> intents and to another App? >>>>> >>>>> Much thanks in advance >>>>> >>>>> Tim >>>>> >>>>> >>>>> >>>>> -- >>> >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "CommCare Developers" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to commcare-developers+unsubscribe@googlegroups.com >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "CommCare Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to commcare-developers+unsubscribe@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >

Great to hear that you got it working!

You should be able to translate the text of the button globally for the app
currently. You can use the locale key:

odk_intent_callout_button

-Clayton

··· On Wed, Aug 27, 2014 at 10:32 AM, Tim Butler wrote:

Hi Clayton and Will

I got there in the end with Will's patience and help.

The Response was held in this code

@Override
public void onBackPressed() {

// Bundle
Intent resultIntent = new Intent();
Bundle extras = new Bundle();
// "CommCareResponse1" can be any name you choose and is used to catch
the repsonse in CommCare
extras.putString("CommCareResponse1", programVariable1);
extras.putString("CommCareResponse2", programVariable1);
resultIntent.putExtra("odk_intent_bundle", extras);
setResult(RESULT_OK, resultIntent);
finish();
super.onBackPressed();

}

Clayton, I think clearer step by step examples would have helped me a lot.
As this is passing between programs, it takes a little time to ensure that
both the send and receive work in both CommCare and the created app.

I also expected to be able to get response from any program api not just
ones I can code myself. Not that much of an issue in this case but would be
if we wanted to interface with other mainstream programs.

The last little thing is naming the button. It would be useful to be able
to modify this through your interface.

For the record, it is working now and we have a real barcode scanner
grabbing 1D barcodes in a split second on a rugged handset :slight_smile:

Best

Tim

On Friday, August 22, 2014 4:22:25 PM UTC+1, Clayton Sims wrote:

Sorry about the somewhat confusing behavior in this regard.

It's not extremely common for applications to maintain a callout contract
that is tremendously generic in some regards, and we didn't want to force
collisions through people's standard app callouts. This behavior is
currently functional but still something we're open to adapting. If you
have comments on how you'd like the intent callout structure to work, feel
free to either email here or make comments on our wiki at

http://github.com/dimagi/commcare-odk

Thanks!
-Clayton

On Fri, Aug 22, 2014 at 5:41 AM, William Pride wpr...@dimagi.com wrote:

Tim,

CommCareODK actually expects either a single string value with key
odk_intent_data and a value that that question will be set to and/or a
Bundle called odk_intent_bundle with a set of key-value pairs, as specified
at the bottom of this page
https://bitbucket.org/commcare/commcare-odk/wiki/ODKActivityCallout.
So your code here will actually look like:

Intent resultIntent = new Intent();
Bundle extras = new Bundle();
extras.putString("BarCodes",single_barcode);
setResult(RESULT_OK, resultIntent);
finish();

Best,
Will

On Fri, Aug 22, 2014 at 5:32 AM, Tim Butler tim.bu...@gmail.com wrote:

I have now got the Called App to return a string to another dummy
program. So now launches the program, scans the value and responds with a
single string.

When I launch with CommCare ODK the program, scans the value and then
crashes ODK with the following message:
08-22 10:03:18.735: E/AndroidRuntime(13771):
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null,
request=10, result=-1, data=Intent { (has extras) }} to activity
{org.xxxxx.demolog/org.odk.collect.android.activities.FormEntryActivity}:
java.lang.NullPointerException

Here is the code

Intent resultIntent = new Intent();
resultIntent.putExtra("BarCodes", single_barcode);
setResult(RESULT_OK, resultIntent);
finish();

In Commcare

Response BarCodes > /data/returnData

Am I missing something? Anyone else had some experience of this?

Much thanks in advance

Tim

On Wednesday, August 20, 2014 9:22:22 AM UTC+1, Tim Butler wrote:

Hi

With Will's advice I have now got the following working:

Intent ID: com.xxxxxxx.android.app.INTENTCALL

Extra:
IntentVariable1 > /data/HiddenIntVar1
IntentVariable2 > /data/HiddenIntVar2

where /data/HiddenIntVar1 and /data/HiddenIntVar2 are populated from
the form.

I am struggling on the response:
ResponseVariable1 > /data/HiddenResVar1

Am I missing something?

Best

Tim

On Tuesday, August 12, 2014 5:50:21 PM UTC+1, Tim Butler wrote:

Hi,

I am using the Android App Callout to test using intents

I am struggling with the syntax and could do with a hand.
I am using the build in alarm as an example.

Intent ID: android.intent.action.SET_ALARM

Extra
android.intent.extra.alarm.MESSAGE Wakey Wakey
android.intent.extra.alarm.HOUR 12
android.intent.extra.alarm.MINUTES 23

The app wont install as soon as I add the Extras.

I have tried just the shortened MESSAGE, HOUR and MINUTES.

Would it be possible to have a simple example of the correct syntax
for Intents including the Response using one of the Standard Android
intents and to another App?

Much thanks in advance

Tim

--


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

--


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

--


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

Hi Clayton,

Thanks for this.

I need to have two varieties, one for scan and one for print.

Any ideas?

Best

Tim

··· On 27 Aug 2014 15:42, "Clayton Sims" wrote:

Great to hear that you got it working!

You should be able to translate the text of the button globally for the
app currently. You can use the locale key:

odk_intent_callout_button

-Clayton

On Wed, Aug 27, 2014 at 10:32 AM, Tim Butler tim.butler.88@gmail.com wrote:

Hi Clayton and Will

I got there in the end with Will's patience and help.

The Response was held in this code

@Override
public void onBackPressed() {

// Bundle
Intent resultIntent = new Intent();
Bundle extras = new Bundle();
// "CommCareResponse1" can be any name you choose and is used to catch
the repsonse in CommCare
extras.putString("CommCareResponse1", programVariable1);
extras.putString("CommCareResponse2", programVariable1);
resultIntent.putExtra("odk_intent_bundle", extras);
setResult(RESULT_OK, resultIntent);
finish();
super.onBackPressed();

}

Clayton, I think clearer step by step examples would have helped me a
lot. As this is passing between programs, it takes a little time to ensure
that both the send and receive work in both CommCare and the created app.

I also expected to be able to get response from any program api not just
ones I can code myself. Not that much of an issue in this case but would be
if we wanted to interface with other mainstream programs.

The last little thing is naming the button. It would be useful to be able
to modify this through your interface.

For the record, it is working now and we have a real barcode scanner
grabbing 1D barcodes in a split second on a rugged handset :slight_smile:

Best

Tim

On Friday, August 22, 2014 4:22:25 PM UTC+1, Clayton Sims wrote:

Sorry about the somewhat confusing behavior in this regard.

It's not extremely common for applications to maintain a callout
contract that is tremendously generic in some regards, and we didn't want
to force collisions through people's standard app callouts. This behavior
is currently functional but still something we're open to adapting. If you
have comments on how you'd like the intent callout structure to work, feel
free to either email here or make comments on our wiki at

http://github.com/dimagi/commcare-odk

Thanks!
-Clayton

On Fri, Aug 22, 2014 at 5:41 AM, William Pride wpr...@dimagi.com wrote:

Tim,

CommCareODK actually expects either a single string value with key
odk_intent_data and a value that that question will be set to and/or a
Bundle called odk_intent_bundle with a set of key-value pairs, as specified
at the bottom of this page
https://bitbucket.org/commcare/commcare-odk/wiki/ODKActivityCallout.
So your code here will actually look like:

Intent resultIntent = new Intent();
Bundle extras = new Bundle();
extras.putString("BarCodes",single_barcode);
setResult(RESULT_OK, resultIntent);
finish();

Best,
Will

On Fri, Aug 22, 2014 at 5:32 AM, Tim Butler tim.bu...@gmail.com wrote:

I have now got the Called App to return a string to another dummy
program. So now launches the program, scans the value and responds with a
single string.

When I launch with CommCare ODK the program, scans the value and then
crashes ODK with the following message:
08-22 10:03:18.735: E/AndroidRuntime(13771):
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null,
request=10, result=-1, data=Intent { (has extras) }} to activity
{org.xxxxx.demolog/org.odk.collect.android.activities.FormEntryActivity}:
java.lang.NullPointerException

Here is the code

Intent resultIntent = new Intent();
resultIntent.putExtra("BarCodes", single_barcode);
setResult(RESULT_OK, resultIntent);
finish();

In Commcare

Response BarCodes > /data/returnData

Am I missing something? Anyone else had some experience of this?

Much thanks in advance

Tim

On Wednesday, August 20, 2014 9:22:22 AM UTC+1, Tim Butler wrote:

Hi

With Will's advice I have now got the following working:

Intent ID: com.xxxxxxx.android.app.INTENTCALL

Extra:
IntentVariable1 > /data/HiddenIntVar1
IntentVariable2 > /data/HiddenIntVar2

where /data/HiddenIntVar1 and /data/HiddenIntVar2 are populated from
the form.

I am struggling on the response:
ResponseVariable1 > /data/HiddenResVar1

Am I missing something?

Best

Tim

On Tuesday, August 12, 2014 5:50:21 PM UTC+1, Tim Butler wrote:

Hi,

I am using the Android App Callout to test using intents

I am struggling with the syntax and could do with a hand.
I am using the build in alarm as an example.

Intent ID: android.intent.action.SET_ALARM

Extra
android.intent.extra.alarm.MESSAGE Wakey Wakey
android.intent.extra.alarm.HOUR 12
android.intent.extra.alarm.MINUTES 23

The app wont install as soon as I add the Extras.

I have tried just the shortened MESSAGE, HOUR and MINUTES.

Would it be possible to have a simple example of the correct syntax
for Intents including the Response using one of the Standard Android
intents and to another App?

Much thanks in advance

Tim

--


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

--


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

--


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

--


You received this message because you are subscribed to a topic in the
Google Groups "CommCare Developers" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/commcare-developers/XQ_Lb5z6K_E/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to
commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tim,

Unfortunately that isn't currently supported. We have an open issue to work
on that feature.

-Clayton

··· On Thu, Aug 28, 2014 at 7:03 AM, Tim Butler wrote:

Hi Clayton,

Thanks for this.

I need to have two varieties, one for scan and one for print.

Any ideas?

Best

Tim
On 27 Aug 2014 15:42, "Clayton Sims" csims@dimagi.com wrote:

Great to hear that you got it working!

You should be able to translate the text of the button globally for the
app currently. You can use the locale key:

odk_intent_callout_button

-Clayton

On Wed, Aug 27, 2014 at 10:32 AM, Tim Butler tim.butler.88@gmail.com wrote:

Hi Clayton and Will

I got there in the end with Will's patience and help.

The Response was held in this code

@Override
public void onBackPressed() {

// Bundle
Intent resultIntent = new Intent();
Bundle extras = new Bundle();
// "CommCareResponse1" can be any name you choose and is used to catch
the repsonse in CommCare
extras.putString("CommCareResponse1", programVariable1);
extras.putString("CommCareResponse2", programVariable1);
resultIntent.putExtra("odk_intent_bundle", extras);
setResult(RESULT_OK, resultIntent);
finish();
super.onBackPressed();

}

Clayton, I think clearer step by step examples would have helped me a
lot. As this is passing between programs, it takes a little time to ensure
that both the send and receive work in both CommCare and the created app.

I also expected to be able to get response from any program api not just
ones I can code myself. Not that much of an issue in this case but would be
if we wanted to interface with other mainstream programs.

The last little thing is naming the button. It would be useful to be
able to modify this through your interface.

For the record, it is working now and we have a real barcode scanner
grabbing 1D barcodes in a split second on a rugged handset :slight_smile:

Best

Tim

On Friday, August 22, 2014 4:22:25 PM UTC+1, Clayton Sims wrote:

Sorry about the somewhat confusing behavior in this regard.

It's not extremely common for applications to maintain a callout
contract that is tremendously generic in some regards, and we didn't want
to force collisions through people's standard app callouts. This behavior
is currently functional but still something we're open to adapting. If you
have comments on how you'd like the intent callout structure to work, feel
free to either email here or make comments on our wiki at

http://github.com/dimagi/commcare-odk

Thanks!
-Clayton

On Fri, Aug 22, 2014 at 5:41 AM, William Pride wpr...@dimagi.com wrote:

Tim,

CommCareODK actually expects either a single string value with key
odk_intent_data and a value that that question will be set to and/or a
Bundle called odk_intent_bundle with a set of key-value pairs, as specified
at the bottom of this page
https://bitbucket.org/commcare/commcare-odk/wiki/ODKActivityCallout.
So your code here will actually look like:

Intent resultIntent = new Intent();
Bundle extras = new Bundle();
extras.putString("BarCodes",single_barcode);
setResult(RESULT_OK, resultIntent);
finish();

Best,
Will

On Fri, Aug 22, 2014 at 5:32 AM, Tim Butler tim.bu...@gmail.com wrote:

I have now got the Called App to return a string to another dummy
program. So now launches the program, scans the value and responds with a
single string.

When I launch with CommCare ODK the program, scans the value and then
crashes ODK with the following message:
08-22 10:03:18.735: E/AndroidRuntime(13771):
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null,
request=10, result=-1, data=Intent { (has extras) }} to activity
{org.xxxxx.demolog/org.odk.collect.android.activities.FormEntryActivity}:
java.lang.NullPointerException

Here is the code

Intent resultIntent = new Intent();
resultIntent.putExtra("BarCodes", single_barcode);
setResult(RESULT_OK, resultIntent);
finish();

In Commcare

Response BarCodes > /data/returnData

Am I missing something? Anyone else had some experience of this?

Much thanks in advance

Tim

On Wednesday, August 20, 2014 9:22:22 AM UTC+1, Tim Butler wrote:

Hi

With Will's advice I have now got the following working:

Intent ID: com.xxxxxxx.android.app.INTENTCALL

Extra:
IntentVariable1 > /data/HiddenIntVar1
IntentVariable2 > /data/HiddenIntVar2

where /data/HiddenIntVar1 and /data/HiddenIntVar2 are populated from
the form.

I am struggling on the response:
ResponseVariable1 > /data/HiddenResVar1

Am I missing something?

Best

Tim

On Tuesday, August 12, 2014 5:50:21 PM UTC+1, Tim Butler wrote:

Hi,

I am using the Android App Callout to test using intents

I am struggling with the syntax and could do with a hand.
I am using the build in alarm as an example.

Intent ID: android.intent.action.SET_ALARM

Extra
android.intent.extra.alarm.MESSAGE Wakey Wakey
android.intent.extra.alarm.HOUR 12
android.intent.extra.alarm.MINUTES 23

The app wont install as soon as I add the Extras.

I have tried just the shortened MESSAGE, HOUR and MINUTES.

Would it be possible to have a simple example of the correct syntax
for Intents including the Response using one of the Standard Android
intents and to another App?

Much thanks in advance

Tim

--


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

--


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

--


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

--


You received this message because you are subscribed to a topic in the
Google Groups "CommCare Developers" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/commcare-developers/XQ_Lb5z6K_E/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to
commcare-developers+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--


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