ConnectorDB Mobile App
If feeling adventurous, you can also try the Testing Releases
This is the ConnectorDB android app. While our usage of React Native enables IOS to use a similar UI, the data-gathering extensively uses native android APIs, so it would need to be rewritten specifically for IOS.
The app gathers the following in the background by default:
- Plug in events
- Location (GPS)
- Screen on/off
- Active App (TODO)
There are additional loggers, not shown here, which are not enabled by default.
The app is divided into two components. The entire UI is written using React Native components, which will allow code sharing with a future IOS app.
On the other hand, all background data-gathering functionality is platform-specific code (Unfortunately, the two mobile OS have fundamentally different APIs for data gathering).
To set up a React Native environment, you will need to follow the tutorial.
To set up the app:
git clone https://github.com/connectordb/connectordb-android cd connectordb-android git submodule update --init npm install
At this point, you can open the ./android directory in android studio, which will create a project for you. After running build in android studio, you need to start the react-native server in the root repo directory:
Once the server boots up, you can run the app in debug mode from android studio
Once you start running the app, you will come across an error connecting to google APIs right after it turns on. This is because the app expects to be able to connect to google's fitness apis (from which it gathers several metrics). You will need to create an OAuth API key for your app as seen here: https://developers.google.com/fit/android/get-api-key
You'll need to use
com.connectordb_android for the package name, and set up your own debug/release keys to gain api access.
Since the menu isn't available in the android virtual device, you'll need to run the following and enable live reload, as well as possibly debug in chrome:
adb shell input keyevent 82
If running on an external device, you'll need to use adb to forward the debug port:
adb reverse tcp:8081 tcp:8081
Follow the instructions here to set up signing key, and run:
cd android && ./gradlew assembleRelease
Adding New Loggers
The app was made with extensibility in mind.
android/app/src/main/java/com/connectordb_android/loggers/ contains all of the data-gathering code. To create a new logger:
BaseLoggerto do your logging. Use the existing loggers as a reference. You can also extend the following convenience classes:
GoogleFitLoggerif using google fit data. It automatically takes care of all syncing/data gathering
ContentProviderLoggerif using a content provider for your data (for example, gathering data from another app).
- Add your logger in
LoggerService.java, so it is started automatically
- Set up any permissions you might need for your logger
android/app/src/main/AndroidManifest.xml: Any permissions you use need to be added here
src/permissions.js: If your logger uses dangerous permissions, you need to add the permission in this file too
android/app/src/main/java/com/connectordb_android/loggers/GoogleApiSingleton.java: If you use any google APIs, you will need to add the API to the API singleton
- Submit a pull request! We'd love to include a variety of loggers (with only some on by default)
Improving the UI
Google Play and the Google Play logo are trademarks of Google Inc.