KiwiPrints-Cordova

Kiwi is an Android application for managing patient health encounters. It uses the [SecugenPlugin] (https://github.com/chrisekelley/SecugenPlugin) to enable fingerprint scanning for identification. This plugin works with the Secugen Hamster Plus fingerprint scanner.

Development

Overview

This application was built using Cordova, which is a container for the single page web application that provides most of the user interface for the app.

Equipment

This project uses a Secugen Hamster Plus for fingerprint scanning. The equipment setup is documented.

Deploy

To deploy to tablet:

cordova run android

Updating the Secugen Plugin

Use platforms/android/bakeapp.sh to refresh the plugin when you change it.

Installing plugins from scratch

cordova plugin add org.apache.cordova.device cordova plugin add org.apache.cordova.vibration cordova plugin add org.apache.cordova.dialogs cordova plugin add org.apache.cordova.file-transfer cordova plugin add org.apache.cordova.geolocation cordova plugin add org.apache.cordova.network-information cordova plugin add https://github.com/chrisekelley/Version.git cordova plugin add com.scispike.logger cordova plugin add org.apache.cordova.file cordova plugin add https://github.com/Initsogar/cordova-webintent.git cordova plugin add /Users/chrisk/source/SecugenPlugin cordova plugin add de.appplant.cordova.plugin.local-notification && cordova prepare

Create a soft link to the coconut code

Clone https://github.com/chrisekelley/coconut ln -s /Users/chrisk/source/coconut/_attachments www

Creating a new project

In CouchDB Futon, clone the following, using a new name for the new db's:

  • coconut-central
  • coconut-forms

Create a new couch for the data

Modify the forms and adjust the urls in coconut-central-newdb/coconut.config and reset coconut-central-newdb/version

Fingerprint Scanning Service Codes:

  • Status Code 0 = Invalid form sent
  • Status Code 1 = Success
  • Status Code 2 = Invalid key
  • Status Code 3 = Invalid ISO template

Configuration

Change the url and paths in res/values/strings.xml

<string name="app_name">Kiwi</string>
<string name="templatePath">/sdcard/Download/fprints/</string>
<string name="serverUrl">http://somewhere.com/</string>
<string name="serverUrlFilepath">api/Person/Enroll</string>
<string name="serverKey">authorizationKey</string>
<string name="templateFormat">TEMPLATE_FORMAT_ISO19794</string>
<string name="APP_VERSION">1</string>
<string name="WIPE_CACHE">1</string>

Updates

Increment APP_VERSION and set WIPE_CACHE = 1 to force the app to wipe the app cache and reset the whole app.

Increment version="1.0.9" and android:versionCode="11" in config.xml.

Read the coconut README for more information on updates.

Debugging

Since the fingerprint scanner uses the device's USB port, you must use wifi debugging. Here are some useful commands:

adb kill-server
adb start-server
adb tcpip 5555
adb shell ip -f inet addr show wlan0 | grep -Po 'inet \K[\d.]+'
adb connect 192.168.0.101

./installapp.sh

Kudos for the one-liner to get the ip address: http://unix.stackexchange.com/a/87470

The platforms/android/bakeapp.sh script is also useful during development when removing/installing the plugin.

Viewing logs

adb logcat | grep adb shell ps | grep org.rti.kidsthrive | cut -c10-15

kudos: http://stackoverflow.com/a/9869609

Creating icons

https://github.com/AlexDisler/cordova-icon

Save icon.png in project root. Save as 192x192. Run cordova-icon.