In CSPro, a sharable URI is a way to reference files in a way that works across applications that are not part of the CSPro ecosystem. The primary use for sharable URIs is to share them with
other Android applications so that those applications can access data or files in the
gov.census.cspro.csentry directory. The way that sharable URIs look depends on the operating system:
On Windows, a sharable URI is the same as a file path. For example:
C:\AMO\Chautauqua-5K-results.pdf
On Android, a sharable URI is a
content URI. For example:
content://gov.census.cspro.csentry.fileprovider/root/storage/emulated/0/Android/data/gov.census.cspro.csentry/files/csentry/AMO/Chautauqua-5K-results.pdf
In CSPro you can work with sharable URIs using the
Action Invoker in the following ways:
Action | Description |
System.getSharableUri | Create a sharable URI that can be used by external applications to reference a file. |
System.selectDocument | Retrieve a sharable URI for one or more documents shared by the system. |
File.copy | Copy a file specified using a sharable URI. |
// query for an image
string selectDocumentJson = CS.System.selectDocument(contentType := "image/*");
if selectDocumentJson <> "" then
// convert the JSON into a CSPro-usable format using a HashMap
HashMap string selectDocumentResult;
selectDocumentResult.updateValueFromJson(selectDocumentJson);
// create the new image path, using the original filename
dircreate("Images");
string imagePath = Path.concat("Images", selectDocumentResult("name"));
// copy the document to the Images directory
CS.File.copy(source := selectDocumentResult("path"),
destination := imagePath);
endif;