Collecting & Analyzing Data on an Android Device
- Companion for Android Introduction
- Initial Set Up
- Designing Forms for Mobile
- Copy Form to Mobile Device
- Collect Data on Mobile Device
- Preload Data on Mobile Device
- Transfer Data From Mobile Device
- Configuring Cloud Synchronization
- Share Spreadsheets Between Mobile Devices
- StatCalc Epidemiologic Calculators
- Analyze Data
- Chapter 6: Companion for Android – Full Chapter
Configuring Cloud Synchronization with Windows Azure
You will need to first create a Windows Azure account at Windows Azure Home. The free tier is sufficient for many data collection activities. Please note that you MUST get organizational approval first if you are using this service for official purposes!
Please complete the steps documented below in order to set up your Companion for Android application with Windows Azure.
Create an Azure App Service Mobile App
1. Create new Mobile App by clicking on: New > Web + Mobile > Mobile App
- Remember “App Name” as it will be used by your Android app
- Create a new Resource Group or choose from Existing
- Choose App Service plan
- Click on Create
- Wait a few minutes; refresh your web browser

Figure 6.37: Create a Mobile Application in Windows Azure

Figure 6.38: Resource group
2. Click the new icon that got created on the dashboard that looks like a tablet. If you don’t see the icon you can go to All resources and find the App Service you just created.

Figure 6.39: All Resources list
3. Under Settings, Go to Mobile Section and click on Easy tables.

Figure 6.40: Easy tables
4. Click on “Need to configure Easy Tables/Easy APIs – Click here to continue.”

Figure 6.41: Configuring Easy Tables
5. Perform Step 1 Connect a database -> “Click here to create one”.

Figure 6.42: Connect to a database
6. In Data Connections blade click on Add.

Figure 6.43: Adding data connections
7. In Add data connection blade click on “Configure required settings”.

Figure 6.44: SQL Database configuration
8. Create a new database or set an existing database.

Figure 6.45: Create a new database
- Provide Name for the database.
- Set pricing tier to Free or as per your need.

Figure 6.46: New database creation parameters
9. Click on Configure required settings to configure database security setting.

Figure 6.47: Configuring server
10. In the New Server blade provide the Server name, Server admin login, Password, confirm password and choose the location of the server. Leave “Allow azure services to access server” checked. Click OK.

Figure 6.48: Configuring server parameters
11. Click OK on New Database blade
12. Click OK in Add data connection blade
13. Data connection creation process starts. Wait for the process to complete in Notification area.

Figure 6.49: Data connection process
14. Easy Tables > “Need to configure Easy Tables/Easy APIs – Click here to continue” (yes, AGAIN!) > Initialize app

Figure 6.50: Configuring Easy tables
15. In Easy Tables blade, perform Step 2 of Initialize app by clicking the acknowledgement check box.

Figure 6.51: Initialize application service
16. Wait for the process to complete, watch the notification area for progress.

Figure 6.52: Initialize application service in progress

Figure 6.53: Initialize application service
17. In Easy Tables click Add to add the table.
- The “Name” here needs to match your Epi Info form name. Table created for both Parent and child form have exactly same name as form name in Epi Info even though we append an underscore on the form name when copying to Android tablet.
- Leave everything anonymous or disable certain functions (don’t enable authentication). Click OK.
18. Newly created table is available in the list of Easy Tables.
19. Click the newly created table.
20. In the blade for the table click on Edit Script.

Figure 6.56: Edit script option
21. Right-click on {your table name}.js and click on Delete in the context menu.

Figure 6.57: Deleting easy table with .js extension
22. Right-click on tables and click on Upload Files in the context menu.

Figure 6.58: Uploading file
23. Upload “easy_tables.js” file.

Figure 6.59: Import of Easy_table.js file
24. In the javascript file for easy_tables.js file change the text that says “CHANGE ME” to a token that you will use on the Android app.

Figure 6.60: Modification of epiToken setting
25. Right-click on “easy_tables.js” and rename to {your table name}.js.

Figure 6.61: Renaming of Easy_table.js file

Figure 6.62: Renaming completed
26. Click {your table name}.json.
a. Set “softDelete” to false.

Figure 6.63: Modification of softDelete parameter in .json file

Figure 6.64: Modification of softDelete parameter in .json file
Configuring the Application to Use the Settings
- From the Companion for Android main menu, click on the Settings option.
Figure 6.40: Companion for Android Configuration Settings
- Provide the Windows Azure Mobile Application name to use for data synchronization in the Azure Mobile Application section. Also, provide the Windows Azure authorization token to use for data synchronization. This was established in the epiToken setting of the .json file corresponding to the form. Turn off “Use Microsoft Azure classic services”.

Figure 6.66: Specify Mobile Application name and Authorization token
Receiving Data and Creating a Data Table in Windows Azure
The last step required in order to synchronize data between the device and the cloud would consist of creating a data table in the cloud. In order to do so, please complete the following steps:
- Login into your Windows Azure account.
- Click on Mobile Services.
- Click on the corresponding mobile service.
- Click on Data.
- Click on Create (located at the bottom of the screen).
- Provide a table name. Please Note that this Table Name must exactly match the corresponding Form Name in the Companion for Android application.
Figure 6.42: Create data table in cloud service
- Click on the check mark icon to complete the table creation process.
At this point, you should be able to start entering data into your android device and synchronizing data using the Sync with Cloud option of the Collect data module.
Figure 6.43: Synchronize data with cloud