sensor

How to get the compass direction from azimuth on Android

点点圈 提交于 2019-12-04 06:37:31
I have to display which direction the user is pointing the Android device. I am using Sensor.TYPE_ACCELEROMETER , Sensor.TYPE_MAGNETIC_FIELD to get the azimuth, pitch, roll. But I am to able to figure out how to get directions (North, south, east , west,...) from this. Please help Thanks To point the north you can calculate a rotation in degrees : float rotation = -azimut * 360 / (2 * 3.14159f); You can see the following compass example which make uses of accelerometer and magnetic field : http://www.codingforandroid.com/2011/01/using-orientation-sensors-simple.html Azimuth on Wikipédia : http

Help with PROXIMITY_SCREEN_OFF_WAKE_LOCK in Android

℡╲_俬逩灬. 提交于 2019-12-04 05:16:23
I've enabled the proximity wakelock in my app, and it turns off the screen when the proximity sensor detects something. But there is a problem when the screen wakes back up -- it goes to the lockscreen, not my app. This happens regardless of the time that the screen was off (even if the sensor is cleared after a few seconds). Here's the code I used: int PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32; mProximityWakeLock = pm.newWakeLock(PROXIMITY_SCREEN_OFF_WAKE_LOCK, LOG_TAG); if(!mProximityWakeLock.isHeld()){ mProximityWakeLock.acquire(); } Is there any way to correct that behavior? You can dismiss the

Detect Google Cardboard Magnetic Button Click in Javascript

本秂侑毒 提交于 2019-12-04 04:44:21
问题 With refering to Detecting Magnetic Button on Cardboard in C# is there anyway to access the magnetic cardboard button within Javascript in a browser of a mobile phone? cheers Stefan 回答1: I was finally able to solve the problem myself. Fortunately time and a bit of luck helped for solution (it wouldn't have been possible by the time I was actually asking for it). The solution is based on the "Generic Sensor API" proposed by the W3C and in particular the implementation for the Magnetometer API.

how to measure HeartBeat using an android device [closed]

北战南征 提交于 2019-12-03 16:48:29
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . My question is very simple and straight forward. Is there any technique through which i can calculate the heartbeat of a person using android device. I googled it and found some results in which they implemented

What is the equivalent for a Hidden Markov Model in the WEKA toolkit?

可紊 提交于 2019-12-03 16:17:09
I need to classify a datastream which comes from a sensor network consisting of 8 accelerometers. Each accelerometer gives me a X Y and Z value. Thus at each sample i have 8 x 3 = 24 acceleration values. I sample at about 30 hz and the performance time is about 0.5 seconds. At first i thought of using a Hidden Markov model for this but it seems that the WEKA toolkit does not provide such a thing. What is the WEKA equivalent for this? Thank you. EDIT: how to format data? I have collected data and now i want to use the HMMWeka for classification. On the website it states that Data instances must

How can I rotate display only in landscape mode in android?

不羁的心 提交于 2019-12-03 14:45:01
问题 I want that my View rotates only in landscape mode, clockwise and counterclockwise. I read about the only counterclockwise for android < 2.2 and that's not a problem, my App will be +2.2 for now. I modify my manifest to catch Configuration Changes android:configChanges="keyboardHidden|orientation" I override my activity to catch Configuration Changes @Override public void onConfigurationChanged(Configuration newConfig) { and I know how to catch orientation Display display = ((WindowManager)

Compute rotation matrix using the magnetic field

╄→гoц情女王★ 提交于 2019-12-03 11:21:35
问题 In get rotation matrix value it contains public static boolean getRotationMatrix (float[] R, float[] I, float[] gravity, float[] geomagnetic) Here how can i calculate the float[] gravity ? I found a sample of code where it calculate the orientation using both Accelerometer and Magnetic field boolean success = SensorManager.getRotationMatrix( matrixR, matrixI, valuesAccelerometer, valuesMagneticField); if(success){ SensorManager.getOrientation(matrixR, matrixValues); double azimuth = Math

Compass and Accelerometer precision

南笙酒味 提交于 2019-12-03 10:11:11
i made my own application in Android that use compass and accelerometer sensors to display the degrees of rotation and inclination of my device. I initialized all the listener and objects i needed (i followed some tutorials), and now i can catch the degrees as i wished. The problem is that the measures that sensors return aren't accurate. I mean even if i try to round the values of degrees i catch from the sensor, they oscillate between -/+ 7 (or 8) degrees every fraction of a second, even if i stay in a grass field away from any disturbing source. What i want to have is a accurate measure of

unable to detect shake event when my phones screen is off in android

帅比萌擦擦* 提交于 2019-12-03 09:00:29
In my application I want to detect the shake event and I'm using SensorEventListener, the code is working fine when my activity is running in foreground. But when I press the lock button of the phone to lock the screen, the shake event can't be detected. I have tested my code on the Samsung gts5360. But the same code is working fine on sony ericssion xperia mini pro. Actually my Samsung phone is not detecting the shake events when I leave the device idle for approx. 45 seconds, after locking the device. Then I shake the phone, it does not detect the shake, but when I shake phone after several

Is there any way to monitor user's movement of iphone like the “raise to speak” feature?

徘徊边缘 提交于 2019-12-03 08:35:27
I want to get notified when the user raises the iphone to his face. Just like siri does. Is it possible? Add more specific requirement: I want to darken the screen when user put the phone near his ear. I know the Proximity Sensor can be enable to implement this. But it's annoying that the screen will be darkened from time to time when user moves the finger upon the sensor. So I wonder how to avoid this case and only darken the screen when user raise the iphone to speak? See Using the Proximity Sensor in the UIDevice Class Reference. So, you: Enable it: UIDevice *device = [UIDevice