• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
      • Overview
      • Execution Environments
        • CSPro Logic
        • OnActionInvokerResult Global Function
        • JavaScript (Embedded)
        • JavaScript (From Web Views)
        • JSON
        • Android Intent
      • Security and Formatting Options
      • Base Actions
      • Application Namespace
      • Clipboard Namespace
      • Data Namespace
      • Dictionary Namespace
      • File Namespace
      • Hash Namespace
      • Localhost Namespace
      • Logic Namespace
      • Message Namespace
      • Path Namespace
      • Settings Namespace
      • Sqlite Namespace
      • System Namespace
      • UI Namespace
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Action Invoker Execution from Other Android Applications

Overview
Running Action Invoker actions from other Android applications is possible by specifying the actions using JSON, passing that JSON in an Intent, and processing the result returned by ActionInvokerActivity. An example of calling into CSEntry, and processing results, is available on GitHub:
  • ActionInvokerDemo Application: https://github.com/CSProDevelopment/ActionInvokerDemo
Calling ActionInvokerActivity
To run the Action Invoker from another Android application, create an Intent and then add extras to the Intent, including:
  • ACTION: The JSON specification of actions. This string is required, and contains a single action specified as an object, or multiple actions specified as an array of objects. For more information about how to specify actions using JSON, read Action Invoker Execution Using JSON.
  • TITLE: This string is displayed by CSEntry when running the actions. The title is optional.
  • ACCESS_TOKEN: This string contains an access token that provides permission to use the Action Invoker. The access token is optional, and if not provided, CSPro will ask the user to approve the external caller's request to access CSPro functionality and data.
  • REFRESH_TOKEN: This optional string contains a refresh token received from the Action Invoker that, once a user has approved access to the Action Invoker, allows repeated use without an access token for a period of time.
  • ABORT_ON_EXCEPTION: This boolean indicates whether the Action Invoker should abort upon an exception occurring. This value is optional and defaults to true. This setting applies only when the JSON specified in ACTION contains multiple actions.
Using this Intent, launch an activity for result, calling:
  • Package: "gov.census.cspro.csentry"
  • Class: "gov.census.cspro.ActionInvokerActivity"
Processing the Result
The result comes with two extras:
  • RESULT: A string containing the result of the action or actions, in the format described on the Action Invoker Execution Using JSON page.
  • REFRESH_TOKEN: If the user approved access to the Action Invoker, a refresh token string is provided. This refresh token can be used to call back into the Action Invoker without needing the user to approve access multiple times. This refresh token is valid for one hour.
When the Action Invoker returns a refresh token, you will want to use it when calling back into the Action Invoker. The purpose of this refresh token is so that you can call into the Action Invoker multiple times without multiple requests for approval providing a suboptimal experience for the user.
See also: Action Invoker Overview, Action Invoker Access Tokens, Interacting With Other Android Applications