Name: RADAR-Commons-Android
Owner: The Hyve
Description: Base android functionality for the RADAR passive application plugins
Forked from: RADAR-CNS/radar-commons-android
Created: 2017-04-13 11:54:13.0
Updated: 2017-04-13 11:54:15.0
Pushed: 2017-12-07 14:23:24.0
Homepage: null
Size: 2646
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Base module for the RADAR passive remote monitoring app. Plugins for that app should implement the API from this base library. Also user interfaces should use this as a base. Currently, the main user interface is RADAR-AndroidApplication.
To add device types to the passive remote monitoring Android app, create a plugin using the following steps (see the RADAR-Android-Pebble repository as an example):
org.radarcns.key.MeasurementKey
. Be sure to set the namespace
property to org.radarcns.mydevicetype
so that generated classes will be put in the right package. All values should have time
and timeReceived
fields, with type double
. These represent the time in seconds since the Unix Epoch (1 January 1970, 00:00:00 UTC). Subsecond precision is possible by using floating point decimals. Until those schemas are published, generate them using Avro tools. Find avro-tools-1.8.1.jar
by going to http://www.apache.org/dyn/closer.cgi/avro/, choosing a mirror, and then downloading avro-1.8.1/java/avro-tools-1.8.1.jar
. You can now generate source code for a schema myschema.avsc
with the following command: -jar avro-tools-1.8.1.jar compile schema path/to/myschema.avsc path/to/plugin/src/main/java
Once the schemas are published as part of the central schemas repository, you can remove the generated files again. Do not publish a non-alpha version of your plugin without the central schemas being published, otherwise there may be class conflicts later on.org.radarcns.mydevicetype
. In that package, create classes that:org.radarcns.android.device.DeviceManager
to connect to a device and collect its data.org.radarcns.android.DeviceState
to keep the current state of the device.org.radarcns.android.device.DeviceService
to run the device manager in.org.radarcns.android.device.DeviceTopics
that contains all Kafka topics that the wearable will generate.org.radarcns.android.device.DeviceServiceProvider
that exposes the new service.AndroidManifest.xml
, referencing the newly created device service. Also add all the required permissions thereDeviceServiceProvider
you just created to the device_services_to_connect
property in app/src/main/res/xml/remote_config_defaults.xml
.Make a pull request once the code is working.
To create an Android App, follow the following steps:
org.radarcns.android.MainActivity
.org.radarcns.android.MainActivityView
. This should reference a layout and update its values based on the services that are connected to the main activity.org.radarcns.android.RadarApplication
.BroadcastListener
that listens to the ACTION_BOOT_COMPLETED
event and starts your MainActivity
subclass. Configure it with the MainActivity.configureRunAtBoot(Class)
method.AndroidManifest.xml
, add your application and service. If wanted add your boot-listener to listen to ACTION_BOOT_COMPLETED
events and set enabled
to false
.src/main/res/xml/remote_config_defaults_template.xml
to app/src/main/res/xml/remote_config_defaults.xml
and insert all needed values there.For latest code use dev
branch. Code should be formatted using the Google Java Code Style Guide, except using 4 spaces as indentation.
If you want to contribute a feature or fix browse our issues, and please make a pull request.