AIRS Intents

In addition to storing locally recorded sensor values in the internal SQLite database, AIRS (since V2.6) allows for sending so-called AIRS intents that can in turn be used by other applications for their own purposes. Note that for complete privacy (i.e., no usage of recordings outside of AIRS), turn off the AIRS intent option in the General Settings!

AIRS intents are so called Android broadcast intents with extra information (being the actual value of the sensor as a String). In order to allow for subscribing to individual sensors, AIRS uses a very simple naming format, namely com.airs.sensor.Symbol where Symbol is the appropriate sensor symbol (find the list of supported sensors here). For instance, a recording of the battery level will be sent under the intent name com.airs.sensor.Ba.

The extra data field Value of the broadcast intent contains a string representation of the value for this particular (sensor) recording.

The following code snippet can be used to utilise the broadcast intents in your own code:

1. first you need to register a listener to the broadcast intent through:

intentFilter = new IntentFilter("com.airs.sensor.Ba");
registerReceiver(SystemReceiver, intentFilter);

You can alternatively declare your BroadcastReceiver in your manifest.xml.

2. then you need to implement the SystemReceiver:

private final BroadcastReceiver SystemReceiver = new BroadcastReceiver() 
{
        @Override
        public void onReceive(Context context, Intent intent) 
        {
            String action = intent.getAction();
            // check which sensor recording you received
            if (action.equals("com.airs.sensor.Ba"))
            {
               // get sensor value from intent
               String value = intent.getStringExtra("Value");
            }
        }
};

Using a BroadcastReceiver allows for having your program sleep until an actual recording (of the sensor you requested) has been made!