This directory contains all the code necessary to build the FDA MyStudies Android application for study participants. Customization of the build.gradle
, api.properties
and strings.xml
files will enable your Android application to interact with the other components of your FDA MyStudies deployment. Further customization of app branding can be accomplished by replacing the default application images with your own. All configuration related to the creation and operation of studies is done using the Study builder
without need for code changes or redeployment of the mobile application.
The FDA MyStudies Android application requires Android Studio and can be run on Android versions starting from Kitkat.
The FDA MyStudies mobile application fetches all study, schedule, activity, eligibility, consent and notification information from the Study datastore
and posts pseudonymized participant response data to the Response datastore
. Consent forms and any other identifiable data is posted to the Participant datastore
. Email and password authentication is handled by the MyStudies Auth server
using OAuth 2.0 and Hydra
.
Note: Be cautious about making changes to
build.gradle
or other files in the/Android/
directory unless those changes are specifically mentioned in the steps below. It is recommended that file editing is done outside of Android Studio, as Android Studio can introduce conflicting configuration files (for example, avoid updating Grade plugin if prompted).
- Set the
applicationId
inAndroid/app/build.gradle
to your Application ID (this will match the value of yourmanual-android-bundle-id
secret when following the semi-automated deployment guide) - Modify
Android/api.properties
to match the configuration of your backend services - Update the following in the
Android/app/src/fda/res/values/strings.xml
file:- Set
deeplink_host
to define the deep link URL that will be used for redirects (for example, if you setdeeplink_host
to<subdomain>.<domain>
your deeplink would beapp://<subdomain>.<domain>/mystudies
) - Set
google_maps_key
to the API key obtained following the instructions located here (you do not need to follow steps from the API key documentation about updating project or application files) - Set
package_name
to the value ofapplicationId
inAndroid/app/build.gradle
- Set
app_name
to the application name that will be shown to users - Customize user-facing text strings as necessary
- Set
- Configure push notifications
- Go to the Firebase console and select the project you configured for Cloud Firestore during
Response datastore
deployment - Register your Android app in the Cloud Messaging section of the Firebase console (the
Android package name
is theapplicationID
value in theAndroid/app/build.gradle
file) - Download the
google-services.json
file from the Firebase project settings page and replaceAndroid/app/src/fda/google-services.json
(you do not need to update either of yourbuild.gradle
files, even if prompted) - To enable Google Analytics, go to the Firebase console, click on the dashboard under Analytics section from the side menu and click on enable Google Analytics button to view the events triggered from the mobile
- Go to the Firebase console and select the project you configured for Cloud Firestore during
- Configure your
Participant datastore
instance to interface with your mobile application (skip this step if following the semi-automated deployment guide - you will complete an automated version of this task when you return to that guide)- Make a copy of the
mystudies_participant_datastore_db_script.sql
and update the values to match your Android configuration - Optionally, configure the iOS fields to match your iOS configuration (not necessary if you are not configuring an iOS application)
- Run your updated
mystudies_app_info_update_db_script.sql
script on themystudies_participant_datastore
database that you created duringParticipant datastore
deployment (instructions)
- Make a copy of the
- Optional. Customize images and text
- Replace images at the appropriate resolution in the
Android/app/src/fda/res/
directories:mipmap-hdpi
,mipmap-mdpi
,mipmap-xhdpi
,mipmap-xxhdpi
,mipmap-xxxhdpi
,drawable-560dpi
,drawable-xhdpi
,drawable-xxhdpi
,drawable-xxxhdpi
- Customize user-facing text in the
Android/app/src/main/res/values/strings.xml
file
- Replace images at the appropriate resolution in the
- Open the
Android/
directory that contains your modifications as an existing project in Android Studio - Install the Android 10 SDK using SDK Manager, then
Sync Project with Gradle Files
(do not update Gradle plugin)
To build and run your FDA MyStudies application, follow the instructions here.
To distribute your application to users, review the options here.
Copyright 2020 Google LLC