Recording Android phone internal sensor data

ODeeKers,
I’m looking at using android internal sensors to record sound levels (Db) and light levels (Lux). I know there is an ODK Sensors project, but as far as I can see it’s been used to access external sensors, like a printer or an arduino with attached sensors. Basically, it looks like it pairs with a bluetooth device to record a reading.

The internal sensors on androids have all kinds of nifty applications, and there are apps like Google Science Journal that will access and record sensor readings. Since these sensors are not accessed through a bluetooth connection, is the ODK approach different to use them? If I want to build a widget for ODK Collect that measures audio or light levels, is it better to do it using ODK Sensor Framework with Collect, or is it better to approach this using the 2.0 approach with ODK Survey?

Your wisdom will be welcome before I get started in the wrong direction.

Neil Hendrick

Heya @Neil_Hendrick! This sounds cool. Can you say a little bit more about how you want these sensor readings triggered? If you want something like geopoint where the user taps a button and gets a reading, possibly after waiting for a bit, these could easily be variants on existing widgets, most likely decimal widget. See the bearing widget for an example. These would likely be no brainers to get in core if they’re relatively common sensors (e.g. the two you’ve mentioned probably just use the built-in mic and camera).

If they’re sensors that only a few devices have or that require some kind of user action, you could write a tiny auxiliary app and use Launching External Apps - ODK Docs to get one or many values back.

I think you would be best taking @LN’s advice, and sticking with ODK Collect rather than moving to ODK-X Sensors and ODK-X Survey. As you said, ODK-X Sensors doesn’t measure what you’re looking for, and on top of that you’d have to migrate your whole workflow to the ODK-X ecosystem which is more complex and work intensive to manage.

I would love to see a new audio or light level widget in Collect. Sounds really cool.

Actually what @Jeff_Beorse answered was somewhat inaccurate, so I am correcting a few things for search purposes for someone later, as this was an historic issue.

Actually ODK-X sensors does have all the internal sensors brought out in an API. Also you do not need to switch to the ODK-X architecture as the ODK Collect can be used if accesses ODK-X Sensors interface. This was done in the Printer widget to print to the Zebra printers.