-
-
Notifications
You must be signed in to change notification settings - Fork 28
Launching CommCare With Session Endpoints
Shubham Goyal edited this page Oct 7, 2021
·
2 revisions
Android applications can launch a particular screen in CommCare using the session endpoint id for that form. This is an alternative workflow for the form entry workflow which builds the session state by looking into the suite.xml
file of the app.
In order to use this API, you'll need
- An CommCare application installed on CommCare 2.51 and above
- For an user to be currently logged in CommCare
- The installed CommCare app to define a session endpoint for the screen that we want to launch.
**Action: ** org.commcare.dalvik.action.CommCareSession
**Extras: **
-
ccodk_session_endpoint_id
: Id of the session endpoint corresponding to the screen we want to launch -
ccodk_session_endpoint_arguments_bundle
orccodk_session_endpoint_arguments_list
: Argument bundle or list that can be passed on to the session endpoint.
Suppose your CommCare app defines an endpoint in the suite.xml
as -
<endpoint id="visit_form">
<argument id="case_id"/>
<stack>
<push>
<command value="'m1-f0'"/>
<datum id="case_id" value="$case_id"/>
</push>
</stack>
</endpoint>
You can launch this endpoint as -
val intent = Intent("org.commcare.dalvik.action.CommCareSession")
intent.putExtra("ccodk_session_endpoint_id","visit_form")
// Add arguments as a bundle, we can also pass in a list instead
val argsAsBundle = Bundle()
argsAsBundle.putString("case_id", "b319e951-03f1-4172-b662-4fb3964a0be7")
intent.putExtra("ccodk_session_endpoint_arguments_bundle", argsAsBundle)
startActivity(intent);