sty

5

New barometric sensor app and code example available for Xperia™ active

Sony Ericsson Barometric Sensor Application
Sony Ericsson Barometric Sensor Application

We recently showed you how to get your apps to work with the Xperia™ active pressure sensor. And to help with your development, we’ve also created a simple app and a new code example that shows you exactly how a pressure sensitive app works. Read on to learn more about our new barometric sensor app, download the apk file and view the new code example.

Awhile back, we brought you an article on how to get your apps to work with the Xperia™ active pressure sensor. In that post, we provided instructions on how to create a simple app that could read data from the pressure sensor, along with tips and code examples to get your app to work with the pressure sensor. This tutorial builds upon that information, and provides you with a code example to show how to create applications that measure altitude differences and vertical air speed using the Xperia™ active pressure sensor. We’ve also created a small app  that demonstrates how the Xperia™ active’s barometric air pressure sensor can be used to measure altitude differences and vertical speed.

How the example app works

The app works by registering as a listener to the air pressure sensor, and receives updates of the values of the sensor. It then takes a number of values (the default is three because at least three values are needed to calculate a median average) and calculates the median pressure value. The median value is chosen since effects of peak values are minimised. A single data sample includes measurements of air pressure, speed and time. These data readings are grouped together as one object, called pressureDataObject. Then the app selects the current sample as the candidate with the median value of air pressure.

After calculating the speed using the previous sample, speed data is added to the current sample. Altitude is calculated using current air pressure minus air pressure at a reference point. The difference in mBar, the metric unit of pressure, is multiplied by 8 to get the altitude in meters, since 8 meters gives an air pressure difference of 1 mBar at sea level. Sea level can be approximated in most cases, since measuring air pressure from an airplane is harder to obtain.

The app also stores air pressure at a reference point, which is used for altitude calculations, since GPS alone is not accurate enough for altitude measurement. The air pressure data of the concerned reference point is stored as a ContentProvider database, which enables anyone to utilise the core data as an altitude or speed logger. Our implementation only provides the bare essentials to display the data, but if you’ve got the time, you can design your app’s UI to display the logged data in a fancier way.

You could also use the Xperia™ active’s GPS satellite-based positioning capabilities to get a better location fix. You can then use this as a reference when you’re using a map on the ground, then get a position with altitude and set that as a fix to get altitude calculations when you’re mountain climbing, paragliding, etc.

To get started, download the code example and APK file for a pressure sensor application that you can use and try out. If you have any questions, feel free to leave to a comment below and we’ll get back to you as soon as we can.

More information

Źródło: New barometric sensor app and code example available for Xperia™ active



Category: Sony Ericsson | Tags: None

Related Posts

  • No related posts found.



You must be logged in to post a comment.

Name (wymagane)

Email (wymagane)

Witryna internetowa

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Share your wisdom

wielkoformatowe wydruki Lublin kolorowe wielkoformatowe skanowanie kolorowe skanowanie w lublinie skanowanie lublin skanowanie Lublin wizytówki w godzinę wizytówki Lublin wizytówki od ręki projekty powykonawcze archiwizacja dokumentacji skanowanie do pliku wielki format wydruki lublin centrum format lublin wielkoformatowe format