Android Question Barometer data

Stulish

Active Member
Licensed User
Longtime User
Has anyone managed to get barometer data from a phones internal barometer sensor, i have a client who would like this information to be sent over bluetooth, but cant seem to see a library or anyway to get this data. He uses a galaxy note 2.

Your thoughts are always welcome and appreciated.

regards

Stu
 

priusfan

Member
Licensed User
Longtime User
Hello,
here is a short extract for using the pressure sensor.
it works perfectly (if there is a pressure sensor....).

B4X:
Sub Service_Create
  ......   
   Dim ps As PhoneSensors
   ps.Initialize2(ps.TYPE_PRESSURE, 2)
   ps.StartListening("PRESSURE")
......
End Sub

Sub PRESSURE_SensorChanged(Values() As Float)
    mB = (mB * 4 + Values(0)) / 5 ' smoothing on 5 consecutive captures
End Sub
 
Upvote 0

Stulish

Active Member
Licensed User
Longtime User
Thanks priusfan, i will check this out
 
Upvote 0

Stulish

Active Member
Licensed User
Longtime User
Thats great it works like a charm on my S3, i didn't even know i had a barometer sensor lol
 
Upvote 0

Stulish

Active Member
Licensed User
Longtime User
One other thing, if someone uses this and doesn't have a barometer sensor, will it cause an error?
 
Upvote 0
Top