This guide will take you through the development of a new passive app plugin with an example examples of how one would develop we developed the Faros plugin.
Initialise plugin repository
To get started, download/ clone the Template plugin repository.
The following steps describe how to set up your own device repository by refactoring the template. We give examples from the Faros plugin.
...
For renaming the package and classes (steps 3 and 4), use the refactor functionality of Android Studio (shift-F6). This also renames all references to the packages and classes.
- Change directory name (
radar-android-template
=>radar-android-faros
) - Open the project in Android Studio.
- Rename the package (
org.radarbase.passive.template
=>org.
.radarbase
.passive.bittium) - Rename the following classes. e.g.:
TemplateDeviceManager
=>FarosDeviceManager
TemplateDeviceServiceProvider
=>FarosProvider
TemplateDeviceService
=>FarosService
TemplateDeviceStatus
=>FarosDeviceStatus
Edit
Configuration parameters, in this case:build.gradle
and input theconfiguration parameters
Code Block ...... //---------------------------------------------------------------------------// // Configuration // //---------------------------------------------------------------------------// group = 'org.radarbase' ext.moduleName = 'radar-android-faros' ext.description = 'Faros plugin for RADAR passive remote monitoring app' ext.githubRepoName = 'RADAR-BASE/radar-android-faros' version = android.defaultConfig.versionName.....
Edit
strings.xml
to give your device a label and description (used in theDeviceServiceProvider
)Code Block <resources> <string name="farosLabel">Faros</string> <string name="farosDescription">Collects data from Faros 90/180/360. The connection is made over Bluetooth using the location permission. Location information is not stored. </string> </resources>
Check the references in the
AndroidManifest.xml
Edit AndroidManifest.xml to put in the references ofpackage
andservice.
Code Block <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.radarbase.passive.bittium" > <application android:allowBackup="true"> <service android:name=".FarosService"/> </application> </manifest>
package
referspackage
refers to the name given to the package (step 3)service android:name
refers to the DeviceService class (step 4)
...