|Project HAB alert app|
This project is about creating an Android app to alert you of high-altitude balloons coming near so you can start tracking them.
Regularly, high-altitude balloons (HABs) are released ("launched") in the UK and many other places around the world. These balloons are usually equipped with a GPS receiver, a small micro-controller and an UHF transmitter broadcasting the balloon's callsign/location/altitude/etc. It's a fun hobby to help track these balloons by receiving the coordinates and submitting them to a central web site. RevSpace has a radio reception setup specifically for this, see HAB Tracker Station.
The problem that the Android app aims to solve is that sometimes a HAB is launched and you're not aware that it's coming into range of the RevSpace HAB tracker, missing the opportunity to track it. The HABAlertApp is an application you can install on your Android OS phone that alerts you as soon as a HAB comes in range of your radio receiver.
My goals for this project are:
- learn even more about android, possibly using android annotions
- learn about effective use of REST interfaces, on both the android app and on the server (JAX-RS/Jersey)
- get experience with the Google Cloud Message (GCM) framework
- finally, have a useful app that alerts me of incoming HABs
The application relies on some additional infrastructure.
In total, the following parts are relevant:
- the spacenear.us / habhub.org web sites, source of up-to-date balloon data
- the hab alert server (called 'server'), keeps track of balloons and receivers and sends out alerts
- google cloud messaging, provides 'push' notifications between the hab alert server and the android app
- the android app (called 'client'), which interacts with the user
Responsibilities of the hab alert server:
- communication with the spacenear.us / habhub.org web sites
- connect and scrape balloon location data
- interpret the data format and extract the current balloon data
- business logic
- keep a list of active balloons
- keep a list of active radio receivers
- keep a list of subscribed clients
- at regular intervals, calculate visibility between balloons and radio receivers and send out notifications to subscribed clients
- communication with google cloud messaging
- serving requests from clients
- add/remove alert subscriptions from clients
- register/unregister radio receivers
- list active balloons with their call-sign, altitude, location, visibility
Responsibilities of the android app are:
- interaction with the user:
- alerting the user, e.g. by beeping/vibrating and showing an icon in the status bar
- showing current balloon info, e.g. a list of balloons with their call-signs / radio settings, sorted by visibility
- setting preferences for alerts:
- location of the radio receiver
- alert criteria, e.g. degrees above horizon
- (optional) back-off time, preventing multiple alerts
HAB alert server
The plan is to use Jersey (JAX-RS) to handle incoming HTTP requests. Jersey works by annotating classes/methods that handle requests.
Message serialization is done using the GSON library. GSON can handle serialization from/to JSON using POJO's without even needing annotations. GSON is used for serialization on the android app too.
HAB alert android app
spacenear.us / habhub.org interface
The interface is HTTP. The messaging format is JSON.
google cloud messaging
Google cloud messaging (GCM) provides a way to 'tickle' (send-to-sync) the app to make it check for any updates. Android will even start the hab alert app if an alert arrives and the app was not running yet.
On the app side, registration to receive hab alerts is a two-step process when using GCM. The app first registers itself to GCM and receives a GCM registration id. The app then registers itself with the hab alert server, providing the GCM registration id.
On the hab alert server side, sending a push message requires the app registration id and a GCM API key (just like many other google interfaces).
GCM allows different kinds of protocols and message formats. We choose the HTTP protocol, using JSON as the message format.