android-sensors

onSensorChanged Google Map Rotate

对着背影说爱祢 提交于 2019-12-11 11:59:00
问题 there is something bug to onSensorChange , I was able to move my map from facing north, my code was correct but its always rotate even the phone not moving @Override protected void onResume() { mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); super.onResume(); mSensorManager.registerListener(this, mAccelerometer,

rotate map according current walk direction android google maps

时光毁灭记忆、已成空白 提交于 2019-12-11 09:43:51
问题 I have an android application with a map of google. Can anybody tell me how we rotate the map according user current direction walking? I have read a lot of information but still a litle bit confused. Thanks 回答1: You can calculate bearing by comparing two points. You said that your user will be walking so that shouldn't be too hard to get two points a distance apart from each other. When you have the two points do some math like so lon1 = degToRad(lon1); lon2 = degToRad(lon2); lat1 = degToRad

How type TYPE_ACCELEROMETER and TYPE_MAGNETIC_FIELD used to make compass on android devices

孤街醉人 提交于 2019-12-11 07:15:36
问题 I am working on an application which uses compass although I successfully implemented it but there is no such brief explanation that how it works . Like how the TYPE_ACCELEROMETER and TYPE_MAGNETIC_FIELD was used to get the orientation. I know we did get it and the zero index of the array we got is the azimuth from which we get the degree and came to know where north is. But how it get to this all. Can anyone explain please? Secondly what if I place my mobile on the floor suppose it points in

OrientationEventListener vs Rotation Vector Sensor to get “orientation”

本秂侑毒 提交于 2019-12-11 06:55:37
问题 The first of all my apologies, if I am using wrong terms. I have done some digging and therefore I am a bit confused. I will correct the question if there are wrong terms.. Which one I should prefer (OrientationEventListener or Rotation Vector Sensor) if I need to get just device "orientation"? And if I have understood the terms correctly then in this case I mean the Yaw by orientation. As a background then I have an app that is locked to e.g. portrait mode, but I would still like to display

Inbuilt sensor calibration functionality in Android

亡梦爱人 提交于 2019-12-11 06:32:09
问题 I am working on an application which utilizes accelerometer and magnetometer data and their fused data to function. Now there's an inherent need when it comes to magnetometer to re-calibrate it regularly. The sensor gets uncalibrated due to a phenomena called hard iron effect. My application requires very accurate sensor data (which the hardware is capable of delivering but noise and uncalibrated values create a roadblock). I also know that there are inbuilt calibration functions running in

Android decibel meter

删除回忆录丶 提交于 2019-12-11 05:20:36
问题 I want to create an app that would be able to use the phone's microphone in order to get the outside noise volume in db. What is the easiest way to do it? 回答1: Check out one of the two projects on code.google.com: http://code.google.com/p/moonblink/wiki/Audalyzer http://code.google.com/p/splmeter/ where as the last projects used this formular for calculating the sound pressure value: http://en.wikipedia.org/wiki/Sound_pressure 来源: https://stackoverflow.com/questions/8288813/android-decibel

Android Sensors - Which of them get direct input?

拟墨画扇 提交于 2019-12-11 05:07:26
问题 the Android SDK actually offers a nice interface to access the sensors. But e.g. the linear acceleration-sensor can be evaluated as the documentation describes from gravity and acceleration - so there is no real physical counterpart for this Sensor, it is rather a - let's call it - "virtual sensor". For the proximity-sensor things are rather clear, i can't imagine it is influenced by some other values. But the GPS-sensor could be influenced by the accleremoter sensor when the GPS-signal is

Fetching direction from Accelerometer using shake action

笑着哭i 提交于 2019-12-11 01:59:02
问题 I have made android app that plays next song when shake once using Accelerometer. Now what i want my in app if a shake the phone in right side it should play the next song in line or if shake in left play previous, can i do it with the logic of axis found at time of shake action if that is possible how can I put axis to the methods of motion detection to know the direction in which the mobile is shaked . If any one have a logic for this please help i am stuck here. 回答1: I did some digging

Get current SensorEvent value

余生颓废 提交于 2019-12-11 01:39:25
问题 I am using Sensor.TYPE_STEP_COUNTER . As far as I know, the android SensorEvent maintains a value since reboot. I can use the following codes to get the value once the onSensorChanged method is called. Like: public void onSensorChanged(SensorEvent event) { System.out.println(event.values[0] ); } However, how can I get the current value without using such a method? I try to use : SensorEvent event = new SensorEvent(); float value = event.value[0]; This won't work. Is there a similar way to get

SensorManager: One SensorEventListener VS Multiple Listeners

百般思念 提交于 2019-12-10 16:35:27
问题 I'm trying to log sensor measurements to the device memory. For this, I register the same SensorEventListener for many sensors, and later separate them using a switch, based on the type. E.g. int type = sensor.getType(); switch (type) { case Sensor.TYPE_ACCELEROMETER: // log accelerometer data break; case Sensor.TYPE_GYROSCOPE: // Log gyroscope data break; ... My question is, what is the most efficient (less battery power consuming) way, having in mind that I registered the listener with