CSPro Android - Data Transfert Guide
CSPro Android - Data Transfert Guide
If your organization has experience with web server maintenance and cyber security, we recommend
using CSWeb as your server. It is optimized to handle small to very large surveys and censuses. However,
if your organization lacks the experience to work with CSWeb we recommend using Dropbox as the
server. It is appropriate for small to medium size surveys and requires no server setup or maintenance
and avoids the cost and difficulty of setting up a CSWeb server. Depending on your organization, a
downside to using Dropbox is that your files will reside on their servers. If that is an issue and your
survey is small to medium the alternative is setting up an FTP server.
As the application developer CSPro Deploy Application allows you to bundle up your project and deploy
it to a server once, so field staff can download it over the internet at their convenience. Here you will
learn how to deploy a single application project.
To get started you will need a Dropbox account and a single application project. This document will refer
to this application as my-questionnaire. Next, open CSPro Deploy Application which can be found under
the Tools menu in CSPro. Use my-questionnaire as the Package name and “Deploy single application
project” as the Description. Drag and drop the directory that contains the my-questionnaire application
onto the white box under Files. Note that only the ent and pff files are added. The ent file will be
deployed as a pen file and any other files that you want to deploy can be added manually by clicking Add
files…
By default, the main dictionary will be checked. This will upload the my-questionnaire dictionary to the
server, preparing the server, so field staff can upload their collected data. As a final step, select the
Dropbox radio button and click Deploy. If this is the first time deploying to Dropbox, you will be
prompted to enter your credentials.
Now field staff, with their device and an installation of CSEntry can download the deployed application
by choosing Add Application from the CSEntry menu.
If this is your first time adding an application from Dropbox you will be prompted to enter your
credentials and will need to allow CSPro to access your files and folders in your Dropbox.
Click INSTALL to download and install the my-questionnaire package on the device.
The my-questionnaire application will be installed and appear in the Entry Applications ready to be
launched.
CSPro Synchronization
CSPro has two different methods of implementing synchronization in your project. The first
implementation, Simple Synchronization is useful when you have only a questionnaire application. It is
quick and easy to add to your project, but not as flexible as Synchronization from Logic. Synchronization
from Logic is useful to synchronize multiple applications or additional files or to synchronize from device
to device (Bluetooth).
Below are the steps to add Simple Synchronization to your single application project. Open the
Synchronization Options from the Options menu.
Now add a listing application to your project. To synchronize the data and application files for multiple
applications you will need to write custom logic. A Synchronization from Logic implementation will only
synchronize external dictionaries, so you will also need to add a menu application. A basic menu
application will launch your applications and synchronize your data and files.
Write your Synchronization from Logic implementation, so that it has the same behavior as the Simple
Synchronization implementation above, but also handle the my-listing application. Therefore, you will:
1. Use Dropbox as the server
2. Upload the data to the server
3. Download updated applications
To synchronize with a server, you will need to first connect to it. Do this by calling the syncconnect
function and providing the server information. Wrap the syncconnect function within an if statement, so
synchronization logic only runs if a connection is established.
if syncconnect(Dropbox) then
Next, upload the data by calling the syncdata function and providing the direction and dictionary name.
syncdata(PUT, MY_LISTING_DICT);
syncdata(PUT, MY_QUESTIONNAIRE_DICT);
To download the application files call syncfile and provide a direction, from path, and to path. A GET
direction will download the files. The from path and to path are relative to this direction. With a GET
direction the from path will refer to a source path on the server and the to path will refer to a
destination path of the device. On the server your application files will reside in the application directory
along the path /my-project/. Since the menu application is currently running, its directory is the current
working directory and all of the to paths will be relative to it.
syncfile(GET, "/my-project/my-menu/my-menu.pen", "./menu.pen");
syncfile(GET, "/my-project/my-menu/my-menu.pff", "./menu.pff");
syncfile(GET, "/my-project/my-listing/my-listing.pen",
"../my-listing/listing.pen");
syncfile(GET, "/my-project/my-listing/my-listing.pff",
"../my-listing/listing.pff");
syncfile(GET, "/my-project/my-questionnaire/my-questionnaire.pen",
"../my-questionnaire/my-questionnaire.pen");
syncfile(GET, "/my-project/my-questionnaire/my-questionnaire.pff",
"../my-questionnaire/my-questionnaire.pff");
Finally, you will call the syncdisconnect function to disconnect from the server and end the if statement.
syncdisconnect();
endif;
CSPro 7.0+ includes an example application called Synchronization in Logic that demonstrates the
Synchronization from Logic implementation.
Bluetooth Synchronization
Synchronizing between two devices (phone or tablet) is similar to synchronizing to Dropbox, FTP, or
CSWeb. You can use the above logic with some minor modifications. Instead of connecting to Dropbox
you will update the syncconnect function with the keyword Bluetooth. Since you are running logic to
connect to the server, you can think of the device that runs this logic as the client. In this example, you
are uploading the data and downloading the application files, so here the client is the enumerator’s
device. Also, the from paths must change, by default this path will be relative to the menu application’s
directory on the server.
if syncconnect(Bluetooth) then
syncdata(PUT, MY_LISTING_DICT);
syncdata(PUT, MY_QUESTIONNAIRE_DICT);
syncfile(GET, "./my-menu.pen", "./menu.pen");
syncfile(GET, "./my-menu.pff", "./menu.pff");
syncfile(GET, "../my-listing/my-listing.pen", "../my-listing/listing.pen");
syncfile(GET, "../my-listing/my-listing.pff", "../my-listing/listing.pff");
syncfile(GET, "../my-questionnaire/my-questionnaire.pen",
"../my-questionnaire/my-questionnaire.pen");
syncfile(GET, "../my-questionnaire/my-questionnaire.pff",
"../my-questionnaire/my-questionnaire.pff");
syncdisconnect();
endif;
The aspect of Bluetooth synchronization that differs is that a local server must be started on the other
device. This device is going to receive the data and have the up-to-date application files, so this server is
the supervisor’s device. To start the local server, call the syncserver function.
syncserver(Bluetooth);
CSPro 7.0+ includes an example application called Synchronization in Logic that demonstrates a
Bluetooth synchronization between an enumerator and a supervisor.
To download the data file (csdb) from the server, use the Data Viewer tool. It can be found under Tools
menu in CSPro. In Data Viewer select Download… under the File menu. In the Download window select
Dropbox and click Connect.
Data Viewer will connect to the server and list the applications with data to download.
Under Data select the application, click the … (browse) button to select where to save the data, enter a
filename, and click the Download button.
The data for my-questionnaire.csdb will be downloaded and opened in Data Viewer.
Dropbox Synchronization FAQ
CSPro's Dropbox sync does not store a single data file in the Dropbox. Instead, it stores a file in
/CSPro/DataSync/ for every synchronization. Because of this, you will not see the data as a single file. In
order to obtain the combined data file, use the Data Viewer to download the data from Dropbox.
Windows
Android
1. Press the Menu icon (vertical ellipses) on the Entry Applications screen of CSEntry
2. Press Settings
3. Press Clear Credentials