Android App - xxyypp/IBM_Dementia GitHub Wiki
During the initial planning phase of the project, some design decisions were made in order to maximise functionality while minimizing cost. The aim was to create a product that was genuinely useful to a dementia patient, and as accessible to the market as possible.
One of the main reasons for the companion smartphone app is in order to prevent the need for a GPS module in the wristband itself, which would have driven up price drastically. By using existing hardware in a smartphone, this additional cost could be avoided. Another reason for a companion app is that a main function of the overall product is instant communication with carers of the dementia patient (referred to as the user) during a period where the user might require help when out alone in public. A phone to communicate through was the clear choice for providing this feature.
Additionally, the wristband only has a touchscreen and physical buttons for interaction, therefore the configuration of settings such as contact details and navigation type would have been more challenging to implement in a fashion that is simple to use. However, these settings are much easier to change through a smartphone app with a more intuitive and larger interface.
Source code of the app is available here
Technical JavaDoc Documentation is available here
The app is a companion software for the wristband. During initial project planning, arguments were made for the use of the wristband itself for obtaining the user’s current location and navigating to the nearest safe place. However, this meant that all the calculation would be held in the wristband. This might cause problems like overheating (processing speed decrease, might be crucial in the emergency case.) and production cost. To solve the problem, we decided to send the SMS message and obtain the GPS location via the phone.
The app relies on the following APIs for some functionalities, such as for location services:
- Google Map SDK
- Google Directions API
- Google Places API
- MQTT Broker
The user interface was designed to be as simple and intuitive as possible, with large icons for the crucial features such as the HELP button and contact icons, no unnecessary UI clutter if not required, and a large map to make the current location more visible to the user. Additionally, the main page has no gestures required, such as swiping between tabs, in order to access app functions. The only two icons in the action bar are for the settings page, which the user would not need to access when in public since relevant settings would be setup beforehand, and a “to-do” button to add a task. Furthermore, the app states clearly at the top, in the action bar, if the wristband is connected or not.
A concern was that the user might forget to charge their phone before going out in public, and the phone might die, cutting off GPS data and communication abilities from the wristband. To combat this, a battery monitoring feature was added to the app. If the phone battery is somewhat low, a notification is sent, along with an optional vibrate alert) to warn the user to charge their phone before heading out. If the phone reaches a critical battery level, an automatic help signal is sent to the carers of the user, alerting them that the user is in a dangerous situation and may need to be collected. The usual current location and next safe place location are sent to the carers (see Help function).
Since he app is the companion software for the wristband, the app needs to communicate with the wristband. We are using MQTT as the protocol for transmitting the information between the two devices. MQTT is a lightweight IoT communication protocol that was developed by IBM. (Link for MQTT website). One alternative option for the protocol is Bluetooth Low Energy. Both of these have their respective pros and cons. Since NodeRed includes an API for MQTT functionality, it was decided to use MQTT in the build.
The flowchart of our app is:
- Help button in the app main page, operating the same function as the wristband.
- User-defined To-do list for the user
- Google map showing the current location
- User-defined destination can be used when click the list under the map
- Emergency contact shortcuts that can send HELP message to each of the contact shortcuts
- Full customize user-setting including navigation options contacts settings and shortcut photo customization
- Wristband connection status and warning
- Low battery warning message, send the current location to all shortcuts if the battery level is crucial.
- Known bugs:
- MQTT runs as service in the background to periodically send current location data. If it is the first time running the app, it sometimes crashes.
- Phone currently acts as the hotspot to enable wristband functionality and MQTT broker/connection
- Text messages (SMS) are the only form of communication in the current build
- MQTT broker IP address is fixed, need to be defined and updated when using different devices
-
Currently for navigation, the Google maps app is opened and navigation is started instantly. Future work would involve incorporating navigation directly on the map shown in the app main page to avoid ever leaving the app main screen.
-
Allow for more forms of configurable communication, such as WhatsApp, Facebook messenger, Skype etc.
-
Allow for custom safe places, such as known houses or workplaces.
-
Allow for real-time tracking instead of periodic snapshot current location data through SMS. Have the navigation inside the app itself, without opening the external app.
-
Bluetooth earphone/ speaker connection can be designed and applied. So that the user can hear and use the Paige AI easier, more convenient and more accurate.
For the initial setup of the phone, please make sure to mark the IP address of your Raspberry Pi and change it corresponding with the IP address in the file:
IBM_Dementia/MyApp/app/src/main/java/helpers/MqttHelper.java
and
Node RED flow MQTT component.
e.g.
final String serverUri = "tcp://xxx.xxx.xxx.xxx:1883";
Replace xxx with the IP address(192.168.43.185) of the Raspberry Pi and hence serverUri = "tcp://192.168.43.185:1883";
Google Map SDK - https://developers.google.com/maps/documentation/android-sdk/intro
Google Place SKD - https://developers.google.com/places/android-sdk/intro
Android Developer - https://developer.android.com/studio/
MQTT - https://www.eclipse.org/paho/clients/java/
- https://wildanmsyah.wordpress.com/2017/05/11/mqtt-android-client-tutorial/
ToDo List - https://www.sitepoint.com/starting-android-development-creating-todo-app/