Poll Serval Mesh for Current State

The Serval Mesh software uses broadcast intents to inform applications that are listening for those intents for changes in state. More information on listening for these broadcasts is available on this wiki page.

Other applications may only wish to check on the current state of the Serval Mesh software, for example to determine if it is running or not. To do this the application can use an Intent with the “org.servalproject.ACTION_STATE_CHECK” action to start an IntentService.

The Serval Mesh application will respond with a broadcast intent using the “org.servalproject.ACTION_STATE_CHECK_UPDATE” action which applications can listen for using a BroadcastReceiver. The intent will have an extra attached that describes the current state of the software.

The StateCheckReceiver in the Serval Mesh Sampler application provides sample code that shows how to extract the value from the intent.

The StateCheckActivity in the Serval Mesh Sampler uses the receiver to display the string representation of the state.


Login