Autor Thema: Develop a plugin for EgiGeoZone  (Gelesen 731 mal)


  • Administrator
  • Hero Member
  • *****
  • Beiträge: 759
    • EgiGeoZone
  • Gerät: Xiaomi Redmi Note 5, Samsung Galaxy Note 2, S4, S5, S2, S7
  • Version: MIUI 10.0 Global, Android 4.4, 5, 6, 7, 8, 8.1, 12, 13
Develop a plugin for EgiGeoZone
« am: 07.10.2015, 08:23:14 »
With version 2.0.4 EgiGeoZone introduced the ability to handle plugins. Here is a short description how to make such a plugin.

This information is further maintained under

Recipe to develop a EgiGeoZone plugin

- First, create a new Android project and then create at least one Activity for the plug-in configuration. The plugin itself is responsible for saving the configuration. You can, for example, save the configuration in the SharedPreferences or in your database.

- The project must also create a BroadcastReceiver or better a WakefulBroadcastReceiver which will receive an Intent. The BroadcastReceiver needs to listen to the action "de.egi.geofence.geozone.plugin.EVENT". The best choice is that the BroadcastReceiver will start a service, which then does the plugin work.

- The EgiGeoZone app Intent provides the following parameters to the plugins:
  • "transition": "1" for entering and "0" for leaving the zone
  • "zone_name": Name of the zone
  • "latitude": latitude of the zone
  • "longitude": longitude zone
  • "device_id": An UUID, which is supposed to represent the ID of the mobile device.
  • "date_iso": UTC date and time in the format "yyyy-MM-dd'T'HH: mm: ss'Z '"
  • "date_device": Local date and time in the format "yyyy-MM-dd'T'HH: mm: ss"

If available to the main app, new parameters can be requested.

- Once an EgiGeoZone event is about to broadcast to the plugins, then the EgiGeoZone app checks, if the plugins have an Intent-Filter with an action "de.egi.geofence.geozone.GETPLUGINS".  Only to this plugins the app will broadcast his Intent.

Example of this part in the manifest file:
android:label="@string/app_name" >
<action android:name="android.intent.action.MAIN" />
<action android:name="de.egi.geofence.geozone.GETPLUGINS" />
<category android:name="android.intent.category.LAUNCHER" />

- Also you need the following permission, which keeps the processor from sleeping when a message is received in the Broadcastreceiver:
   <uses-permission android:name="android.permission.WAKE_LOCK" />

- Under the Administration section the EgiGeoZone app shows a list of the found plugins on the device. With a tap on one of the plugins, the main activity of the plugin can be invoked. So it is a good idea to have the application label and application icon referenced in the manifest file:

- Again: the receiver of the plugin needs to listen to the action "de.egi.geofence.geozone.plugin.EVENT":
         <receiver android:name=".ExampleBroadcastReceiverPlugin">
                  <action android:name="de.egi.geofence.geozone.plugin.EVENT" />

- An example plugin source code can be downloaded here:
- The app can also be found in the Google Play Store:
« Letzte Änderung: 07.10.2015, 19:40:14 von Admin »
Schöne Grüße